tree ec52740643c710072aab5122e96851c63ed049a0
parent f10eff26831159f52353e8f15c37cdb2935d5fbf
author John McCutchan <[EMAIL PROTECTED]> Fri, 05 Aug 2005 05:12:54 -0400
committer Linus Torvalds <[EMAIL PROTECTED]> Fri, 05 Aug 2005 11:37:39 -0700

[PATCH] Clean up inotify delete race fix

This avoids the whole #ifdef mess by just getting a copy of
dentry->d_inode before d_delete is called - that makes the codepaths the
same for the INOTIFY/DNOTIFY cases as for the regular no-notify case.
I've been running this under a Gnome session for the last 10 minutes.
Inotify is being used extensively.

Signed-off-by: John McCutchan <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 fs/namei.c               |    9 ++-------
 include/linux/fsnotify.h |    4 +---
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1874,14 +1874,9 @@ 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);
+               struct inode *inode = dentry->d_inode;
                d_delete(dentry);
-               fsnotify_unlink(dentry, dir);
-               dput(dentry);
-#else
-               d_delete(dentry);
-#endif
+               fsnotify_unlink(dentry, inode, dir);
        }
 
        return error;
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -46,10 +46,8 @@ static inline void fsnotify_move(struct 
 /*
  * fsnotify_unlink - file was unlinked
  */
-static inline void fsnotify_unlink(struct dentry *dentry, struct inode *dir)
+static inline void fsnotify_unlink(struct dentry *dentry, struct inode *inode, 
struct inode *dir)
 {
-       struct inode *inode = dentry->d_inode;
-
        inode_dir_notify(dir, DN_DELETE);
        inotify_inode_queue_event(dir, IN_DELETE, 0, dentry->d_name.name);
        inotify_inode_queue_event(inode, IN_DELETE_SELF, 0, NULL);
-
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