290 int error;
291 size_t namelen;
292 hlnode_t *hnp;
293 timestruc_t now;
294
295 ASSERT(RW_WRITE_HELD(&dir->hln_rwlock));
296 ASSERT(RW_WRITE_HELD(&hp->hln_rwlock));
297 ASSERT(dir->hln_type == VDIR);
298
299 if (nm[0] == '\0')
300 panic("hyprlofs_dirdelete: NULL name for %p", (void *)hp);
301
302 /* return error if removing . or .. */
303 if (nm[0] == '.') {
304 if (nm[1] == '\0')
305 return (EINVAL);
306 if (nm[1] == '.' && nm[2] == '\0')
307 return (EEXIST); /* thus in ufs */
308 }
309
310 if (error = hyprlofs_taccess(dir, VEXEC|VWRITE, cr))
311 return (error);
312
313 if (dir->hln_dir == NULL)
314 return (ENOENT);
315
316 hpdp = hyprlofs_hash_lookup(nm, dir, 0, &hnp);
317 if (hpdp == NULL) {
318 /*
319 * If it is gone, some other thread got here first!
320 * Return error ENOENT.
321 */
322 return (ENOENT);
323 }
324
325 /*
326 * If the hlnode in the hldirent changed (shouldn't happen since we
327 * don't support rename) then original is gone, so return that status
328 * (same as UFS).
329 */
330 if (hp != hnp)
|
290 int error;
291 size_t namelen;
292 hlnode_t *hnp;
293 timestruc_t now;
294
295 ASSERT(RW_WRITE_HELD(&dir->hln_rwlock));
296 ASSERT(RW_WRITE_HELD(&hp->hln_rwlock));
297 ASSERT(dir->hln_type == VDIR);
298
299 if (nm[0] == '\0')
300 panic("hyprlofs_dirdelete: NULL name for %p", (void *)hp);
301
302 /* return error if removing . or .. */
303 if (nm[0] == '.') {
304 if (nm[1] == '\0')
305 return (EINVAL);
306 if (nm[1] == '.' && nm[2] == '\0')
307 return (EEXIST); /* thus in ufs */
308 }
309
310 if ((error = hyprlofs_taccess(dir, VEXEC|VWRITE, cr)) != 0)
311 return (error);
312
313 if (dir->hln_dir == NULL)
314 return (ENOENT);
315
316 hpdp = hyprlofs_hash_lookup(nm, dir, 0, &hnp);
317 if (hpdp == NULL) {
318 /*
319 * If it is gone, some other thread got here first!
320 * Return error ENOENT.
321 */
322 return (ENOENT);
323 }
324
325 /*
326 * If the hlnode in the hldirent changed (shouldn't happen since we
327 * don't support rename) then original is gone, so return that status
328 * (same as UFS).
329 */
330 if (hp != hnp)
|