Commit e234f35c authored by John McCutchan's avatar John McCutchan Committed by Linus Torvalds

[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: default avatarJohn McCutchan <ttb@tentacle.dhs.org>
Signed-off-by: default avatarRobert Love <rml@novell.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3de11748
...@@ -1801,8 +1801,8 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -1801,8 +1801,8 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
} }
up(&dentry->d_inode->i_sem); up(&dentry->d_inode->i_sem);
if (!error) { if (!error) {
fsnotify_rmdir(dentry, dentry->d_inode, dir);
d_delete(dentry); d_delete(dentry);
fsnotify_rmdir(dentry, dentry->d_inode, dir);
} }
dput(dentry); dput(dentry);
...@@ -1874,8 +1874,14 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1874,8 +1874,14 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
/* We don't d_delete() NFS sillyrenamed files--they still exist. */ /* We don't d_delete() NFS sillyrenamed files--they still exist. */
if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
#if defined(CONFIG_INOTIFY) || defined(CONFIG_DNOTIFY)
dget(dentry);
d_delete(dentry);
fsnotify_unlink(dentry, dir); fsnotify_unlink(dentry, dir);
dput(dentry);
#else
d_delete(dentry); d_delete(dentry);
#endif
} }
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment