From a35e60a7a2389f30e1b7525c1fe08a44fd05716c Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Mon, 15 Aug 2005 12:13:28 -0400 Subject: [PATCH] --- yaml --- r: 5795 b: refs/heads/master c: 89204c40a03346cd951e698d854105db4cfedc28 h: refs/heads/master i: 5793: 8f78a4f7ea43b1c3c09254fb68ae2a981dfe024e 5791: a70f423557bf1d54055684c3beeaf3604cb79efa v: v3 --- [refs] | 2 +- trunk/fs/namei.c | 3 ++- trunk/include/linux/fsnotify.h | 6 +++++- trunk/include/linux/inotify.h | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index e6a941f1b897..4e0c78b810e7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0bf955ce98cb3cf40e20d0cc435299eb76e8819e +refs/heads/master: 89204c40a03346cd951e698d854105db4cfedc28 diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 57046d98a746..b85f158aef0c 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -2216,7 +2216,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, error = vfs_rename_other(old_dir,old_dentry,new_dir,new_dentry); if (!error) { const char *new_name = old_dentry->d_name.name; - fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir, new_dentry->d_inode); + fsnotify_move(old_dir, new_dir, old_name, new_name, is_dir, + new_dentry->d_inode, old_dentry->d_inode); } fsnotify_oldname_free(old_name); diff --git a/trunk/include/linux/fsnotify.h b/trunk/include/linux/fsnotify.h index 602c305c8585..03b8e7932b83 100644 --- a/trunk/include/linux/fsnotify.h +++ b/trunk/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, struct inode *target) + int isdir, struct inode *target, struct inode *source) { u32 cookie = inotify_get_cookie(); @@ -41,6 +41,10 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, inotify_inode_queue_event(target, IN_DELETE_SELF, 0, NULL); inotify_inode_is_dead(target); } + + if (source) { + inotify_inode_queue_event(source, IN_MOVE_SELF, 0, NULL); + } } /* diff --git a/trunk/include/linux/inotify.h b/trunk/include/linux/inotify.h index a40c2bf0408e..93bb3afe646b 100644 --- a/trunk/include/linux/inotify.h +++ b/trunk/include/linux/inotify.h @@ -35,6 +35,7 @@ struct inotify_event { #define IN_CREATE 0x00000100 /* Subfile was created */ #define IN_DELETE 0x00000200 /* Subfile was deleted */ #define IN_DELETE_SELF 0x00000400 /* Self was deleted */ +#define IN_MOVE_SELF 0x00000800 /* Self was moved */ /* the following are legal events. they are sent as needed to any watch */ #define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */ @@ -56,7 +57,8 @@ struct inotify_event { */ #define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \ IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \ - IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF) + IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \ + IN_MOVE_SELF) #ifdef __KERNEL__