On Mon, Jun 23, 2025 at 1:59 PM Jan Kara <jack@xxxxxxx> wrote: > > On Mon 23-06-25 11:01:29, Christian Brauner wrote: > > Allow a filesystem to indicate that it supports encoding autonomous file > > handles that can be decoded without having to pass a filesystem for the > > filesystem. In other words, the file handle uniquely identifies the > > filesystem. > > > > Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> > > ... > > > diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h > > index 45b38a29643f..959a1f7d46d0 100644 > > --- a/include/linux/exportfs.h > > +++ b/include/linux/exportfs.h > > @@ -194,7 +194,8 @@ struct handle_to_path_ctx { > > /* Flags supported in encoded handle_type that is exported to user */ > > #define FILEID_IS_CONNECTABLE 0x10000 > > #define FILEID_IS_DIR 0x20000 > > -#define FILEID_VALID_USER_FLAGS (FILEID_IS_CONNECTABLE | FILEID_IS_DIR) > > +#define FILEID_IS_AUTONOMOUS 0x40000 > > +#define FILEID_VALID_USER_FLAGS (FILEID_IS_CONNECTABLE | FILEID_IS_DIR | FILEID_IS_AUTONOMOUS) > > Is there a reason for FILEID_IS_AUTONOMOUS? As far as I understand the > fh_type has to encode filesystem type anyway so that you know which root to > pick. So FILEID_IS_AUTONOMOUS is just duplicating the information? But > maybe there's some benefit in having FILEID_IS_AUTONOMOUS which I'm > missing... The use of the high 16bits as a way for vfs to describe properties on the fhandle relies on the fact that filesystems, out of tree as well, are not allowed to return a type with high 16 bits set and we also enforce that. FWIW, the type is documented in exporting.rst FWIW as single byte: "A filehandle fragment consists of an array of 1 or more 4byte words, together with a one byte "type"." It is important to remember that filesystems file handles and their types are opaque and that filesystems in and of tree do not need to use constants defined in exportfs.h nor to avoid with collisions with the namespace of file type constants. This way, to let vfs raise the autonomous flag based on export_op flags seems more backward compat and leaves less room for mistakes IMO. This way, to let vfs raise the autonomous flag based on export_op flags seems more backward compat and leaves less room for mistakes IMO. Thanks, Amir.