tree 6e23053de3e84c1d8f54531a52fda68cee2bf03b
parent 3de11748c1b312833e8a148ab7ec47669ecc99dc
author John McCutchan <[EMAIL PROTECTED]> Fri, 05 Aug 2005 03:07:08 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Fri, 05 Aug 2005 03:11:15 -0700

[PATCH] inotify delete race fix

The included patch fixes a problem where a inotify client would receive a
delete event before the file was actually deleted.  The bug affects both
dnotify & inotify.

Signed-off-by: John McCutchan <[EMAIL PROTECTED]>
Signed-off-by: Robert Love <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 fs/namei.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1801,8 +1801,8 @@ int vfs_rmdir(struct inode *dir, struct 
        }
        up(&dentry->d_inode->i_sem);
        if (!error) {
-               fsnotify_rmdir(dentry, dentry->d_inode, dir);
                d_delete(dentry);
+               fsnotify_rmdir(dentry, dentry->d_inode, dir);
        }
        dput(dentry);
 
@@ -1874,8 +1874,14 @@ int vfs_unlink(struct inode *dir, struct
 
        /* We don't d_delete() NFS sillyrenamed files--they still exist. */
        if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
+#if defined(CONFIG_INOTIFY) || defined(CONFIG_DNOTIFY)
+               dget(dentry);
+               d_delete(dentry);
                fsnotify_unlink(dentry, dir);
+               dput(dentry);
+#else
                d_delete(dentry);
+#endif
        }
 
        return error;
-
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