Skip to content

Commit

Permalink
fsnotify: move events should indicate the event was on a child
Browse files Browse the repository at this point in the history
fsnotify tells its listeners explicitly when an event happened on the given
inode verses on the child of the given inode.  (see __fsnotify_parent)
However, the semantics of fsnotify_move() are such that we deliver events
directly to the two parent directories in question (old_dir and new_dir)
directly without using the __fsnotify_parent() call.  fsnotify should be
adding FS_EVENT_ON_CHILD for the notifications to these parents.

Signed-off-by: Eric Paris <eparis@redhat.com>
  • Loading branch information
Eric Paris committed Jun 11, 2009
1 parent 63c882a commit ff52cc2
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions include/linux/fsnotify.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,18 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
struct inode *source = moved->d_inode;
u32 in_cookie = inotify_get_cookie();
u32 fs_cookie = fsnotify_get_cookie();
__u32 old_dir_mask = 0;
__u32 new_dir_mask = 0;
__u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM);
__u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO);

if (old_dir == new_dir) {
old_dir_mask = FS_DN_RENAME;
}
if (old_dir == new_dir)
old_dir_mask |= FS_DN_RENAME;

if (isdir) {
isdir = IN_ISDIR;
old_dir_mask |= FS_IN_ISDIR;
new_dir_mask |= FS_IN_ISDIR;
}

old_dir_mask |= FS_MOVED_FROM;
new_dir_mask |= FS_MOVED_TO;

inotify_inode_queue_event(old_dir, IN_MOVED_FROM|isdir, in_cookie, old_name,
source);
inotify_inode_queue_event(new_dir, IN_MOVED_TO|isdir, in_cookie, new_name,
Expand Down

0 comments on commit ff52cc2

Please sign in to comment.