• Amir Goldstein's avatar
    fsnotify: move fsnotify_open() hook into do_dentry_open() · 7b8c9d7b
    Amir Goldstein authored
    fsnotify_open() hook is called only from high level system calls
    context and not called for the very many helpers to open files.
    
    This may makes sense for many of the special file open cases, but it is
    inconsistent with fsnotify_close() hook that is called for every last
    fput() of on a file object with FMODE_OPENED.
    
    As a result, it is possible to observe ACCESS, MODIFY and CLOSE events
    without ever observing an OPEN event.
    
    Fix this inconsistency by replacing all the fsnotify_open() hooks with
    a single hook inside do_dentry_open().
    
    If there are special cases that would like to opt-out of the possible
    overhead of fsnotify() call in fsnotify_open(), they would probably also
    want to avoid the overhead of fsnotify() call in the rest of the fsnotify
    hooks, so they should be opening that file with the __FMODE_NONOTIFY flag.
    
    However, in the majority of those cases, the s_fsnotify_connectors
    optimization in fsnotify_parent() would be sufficient to avoid the
    overhead of fsnotify() call anyway.
    Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Message-Id: <20230611122429.1499617-1-amir73il@gmail.com>
    7b8c9d7b
fhandle.c 7.19 KB