summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJohn McCutchan <ttb@tentacle.dhs.org>2005-08-04 13:07:08 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-04 13:11:15 -0700
commite234f35c54a30d040313e40833dcf623d14629b4 (patch)
tree6e23053de3e84c1d8f54531a52fda68cee2bf03b /fs
parent3de11748c1b312833e8a148ab7ec47669ecc99dc (diff)
downloadblackbird-op-linux-e234f35c54a30d040313e40833dcf623d14629b4.tar.gz
blackbird-op-linux-e234f35c54a30d040313e40833dcf623d14629b4.zip
[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')
-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)
}
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 dentry *dentry)
/* 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;
OpenPOWER on IntegriCloud