Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8c6d21528406ec719aaea9d589876fd105c31646
Commit:     8c6d21528406ec719aaea9d589876fd105c31646
Parent:     d728900cd5502927158db747c653007cf72e2e49
Author:     Jan Harkes <[EMAIL PROTECTED]>
AuthorDate: Thu Jul 19 01:48:43 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Jul 19 10:04:48 2007 -0700

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/coda/dir.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 56a3b76..01f55f4 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -391,28 +391,23 @@ int coda_rmdir(struct inode *dir, struct dentry *de)
 {
        const char *name = de->d_name.name;
        int len = de->d_name.len;
-        int error;
+       int error;
 
        lock_kernel();
        coda_vfs_stat.rmdir++;
 
-       if (!d_unhashed(de)) {
-               unlock_kernel();
-               return -EBUSY;
-       }
        error = venus_rmdir(dir->i_sb, coda_i2f(dir), name, len);
+       if (!error) {
+               /* VFS may delete the child */
+               if (de->d_inode)
+                   de->d_inode->i_nlink = 0;
 
-       if ( error ) {
-               unlock_kernel();
-               return error;
+               /* fix the link count of the parent */
+               coda_dir_drop_nlink(dir);
+               coda_dir_update_mtime(dir);
        }
-
-       coda_dir_drop_nlink(dir);
-       coda_dir_update_mtime(dir);
-       drop_nlink(de->d_inode);
-       d_delete(de);
        unlock_kernel();
-       return 0;
+       return error;
 }
 
 /* rename */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to