• Amir Goldstein's avatar
    fanotify: merge duplicate events on parent and child · f367a62a
    Amir Goldstein authored
    With inotify, when a watch is set on a directory and on its child, an
    event on the child is reported twice, once with wd of the parent watch
    and once with wd of the child watch without the filename.
    
    With fanotify, when a watch is set on a directory and on its child, an
    event on the child is reported twice, but it has the exact same
    information - either an open file descriptor of the child or an encoded
    fid of the child.
    
    The reason that the two identical events are not merged is because the
    object id used for merging events in the queue is the child inode in one
    event and parent inode in the other.
    
    For events with path or dentry data, use the victim inode instead of the
    watched inode as the object id for event merging, so that the event
    reported on parent will be merged with the event reported on the child.
    
    Link: https://lore.kernel.org/r/20200319151022.31456-9-amir73il@gmail.comSigned-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    f367a62a
fanotify.c 14.6 KB