aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorJohn McCutchan <ttb@tentacle.dhs.org>2005-08-04 16:07:08 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-04 16:11:15 -0400
commite234f35c54a30d040313e40833dcf623d14629b4 (patch)
tree6e23053de3e84c1d8f54531a52fda68cee2bf03b /fs/namei.c
parent3de11748c1b312833e8a148ab7ec47669ecc99dc (diff)
[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 <ttb@tentacle.dhs.org> Signed-off-by: Robert Love <rml@novell.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 4a27eb798118..83559dce4286 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1801,8 +1801,8 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
1801 } 1801 }
1802 up(&dentry->d_inode->i_sem); 1802 up(&dentry->d_inode->i_sem);
1803 if (!error) { 1803 if (!error) {
1804 fsnotify_rmdir(dentry, dentry->d_inode, dir);
1805 d_delete(dentry); 1804 d_delete(dentry);
1805 fsnotify_rmdir(dentry, dentry->d_inode, dir);
1806 } 1806 }
1807 dput(dentry); 1807 dput(dentry);
1808 1808
@@ -1874,8 +1874,14 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
1874 1874
1875 /* We don't d_delete() NFS sillyrenamed files--they still exist. */ 1875 /* We don't d_delete() NFS sillyrenamed files--they still exist. */
1876 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { 1876 if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
1877#if defined(CONFIG_INOTIFY) || defined(CONFIG_DNOTIFY)
1878 dget(dentry);
1879 d_delete(dentry);
1877 fsnotify_unlink(dentry, dir); 1880 fsnotify_unlink(dentry, dir);
1881 dput(dentry);
1882#else
1878 d_delete(dentry); 1883 d_delete(dentry);
1884#endif
1879 } 1885 }
1880 1886
1881 return error; 1887 return error;