• Amir Goldstein's avatar
    fanotify: report FAN_ONDIR to listener with FAN_REPORT_FID · e7fce6d9
    Amir Goldstein authored
    dirent modification events (create/delete/move) do not carry the
    child entry name/inode information. Instead, we report FAN_ONDIR
    for mkdir/rmdir so user can differentiate them from creat/unlink.
    
    This is consistent with inotify reporting IN_ISDIR with dirent events
    and is useful for implementing recursive directory tree watcher.
    
    We avoid merging dirent events referring to subdirs with dirent events
    referring to non subdirs, otherwise, user won't be able to tell from a
    mask FAN_CREATE|FAN_DELETE|FAN_ONDIR if it describes mkdir+unlink pair
    or rmdir+create pair of events.
    
    For backward compatibility and consistency, do not report FAN_ONDIR
    to user in legacy fanotify mode (reporting fd) and report FAN_ONDIR
    to user in FAN_REPORT_FID mode for all event types.
    
    Cc: <linux-api@vger.kernel.org>
    Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    e7fce6d9
fanotify.h 2.66 KB