aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/dir.c
diff options
context:
space:
mode:
authorJan Harkes <jaharkes@cs.cmu.edu>2007-07-19 04:48:43 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:48 -0400
commit8c6d21528406ec719aaea9d589876fd105c31646 (patch)
tree00ff80bd206e5178cf57e37844d7512687ea2f59 /fs/coda/dir.c
parentd728900cd5502927158db747c653007cf72e2e49 (diff)
coda: allow removal of busy directories
A directory without children may still be busy when it is the cwd for some process. We can safely remove such a directory because the VFS prevents further operations. Also we don't need to call d_delete as it is already called in vfs_rmdir. Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/coda/dir.c')
-rw-r--r--fs/coda/dir.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 56a3b76b91ca..01f55f447d82 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -391,28 +391,23 @@ int coda_rmdir(struct inode *dir, struct dentry *de)
391{ 391{
392 const char *name = de->d_name.name; 392 const char *name = de->d_name.name;
393 int len = de->d_name.len; 393 int len = de->d_name.len;
394 int error; 394 int error;
395 395
396 lock_kernel(); 396 lock_kernel();
397 coda_vfs_stat.rmdir++; 397 coda_vfs_stat.rmdir++;
398 398
399 if (!d_unhashed(de)) {
400 unlock_kernel();
401 return -EBUSY;
402 }
403 error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len); 399 error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len);
400 if (!error) {
401 /* VFS may delete the child */
402 if (de->d_inode)
403 de->d_inode->i_nlink = 0;
404 404
405 if ( error ) { 405 /* fix the link count of the parent */
406 unlock_kernel(); 406 coda_dir_drop_nlink(dir);
407 return error; 407 coda_dir_update_mtime(dir);
408 } 408 }
409
410 coda_dir_drop_nlink(dir);
411 coda_dir_update_mtime(dir);
412 drop_nlink(de->d_inode);
413 d_delete(de);
414 unlock_kernel(); 409 unlock_kernel();
415 return 0; 410 return error;
416} 411}
417 412
418/* rename */ 413/* rename */