Skip to content

Commit

Permalink
[PATCH] inotify delete race fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
John McCutchan authored and Linus Torvalds committed Aug 4, 2005
1 parent 3de1174 commit e234f35
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e234f35

Please sign in to comment.