aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn McCutchan <ttb@tentacle.dhs.org>2005-08-01 11:00:45 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-01 09:16:53 -0700
commit7544953685859875b5ac0260b6b1856066c092d6 (patch)
treeacfe43ff758f7d7a6d0c575ca0e4f343b3640984 /include
parentbe2ac68f7b66e90b8d25c168fc4d033b034f5c43 (diff)
[PATCH] inotify: fix file deletion by rename detection
When a file is moved over an existing file that you are watching, inotify won't send you a DELETE_SELF event and it won't unref the inode until the inotify instance is closed by the application. Signed-off-by: John McCutchan <ttb@tentacle.dhs.org> Signed-off-by: Robert Love <rml@novell.com> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fsnotify.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index d07a92c9477..e96a4306ab3 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -21,7 +21,7 @@
*/
static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
const char *old_name, const char *new_name,
- int isdir)
+ int isdir, struct inode *target)
{
u32 cookie = inotify_get_cookie();
@@ -36,6 +36,11 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
isdir = IN_ISDIR;
inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir,cookie,old_name);
inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, cookie, new_name);
+
+ if (target) {
+ inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL);
+ inotify_inode_is_dead(target);
+ }
}
/*