• Amir Goldstein's avatar
    exportfs: support encoding non-decodeable file handles by default · 64343119
    Amir Goldstein authored
    AT_HANDLE_FID was added as an API for name_to_handle_at() that request
    the encoding of a file id, which is not intended to be decoded.
    
    This file id is used by fanotify to describe objects in events.
    
    So far, overlayfs is the only filesystem that supports encoding
    non-decodeable file ids, by providing export_operations with an
    ->encode_fh() method and without a ->decode_fh() method.
    
    Add support for encoding non-decodeable file ids to all the filesystems
    that do not provide export_operations, by encoding a file id of type
    FILEID_INO64_GEN from { i_ino, i_generation }.
    
    A filesystem may that does not support NFS export, can opt-out of
    encoding non-decodeable file ids for fanotify by defining an empty
    export_operations struct (i.e. with a NULL ->encode_fh() method).
    
    This allows the use of fanotify events with file ids on filesystems
    like 9p which do not support NFS export to bring fanotify in feature
    parity with inotify on those filesystems.
    
    Note that fanotify also requires that the filesystems report a non-null
    fsid.  Currently, many simple filesystems that have support for inotify
    (e.g. debugfs, tracefs, sysfs) report a null fsid, so can still not be
    used with fanotify in file id reporting mode.
    Reviewed-by: default avatarJan Kara <jack@suse.cz>
    Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
    Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Link: https://lore.kernel.org/r/20231023180801.2953446-5-amir73il@gmail.comSigned-off-by: default avatarChristian Brauner <brauner@kernel.org>
    64343119
exportfs.h 9.7 KB