]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
exportfs: define FILEID_INO64_GEN* file handle types
authorAmir Goldstein <amir73il@gmail.com>
Mon, 23 Oct 2023 18:08:00 +0000 (21:08 +0300)
committerChristian Brauner <brauner@kernel.org>
Sat, 28 Oct 2023 14:16:18 +0000 (16:16 +0200)
Similar to the common FILEID_INO32* file handle types, define common
FILEID_INO64* file handle types.

The type values of FILEID_INO64_GEN and FILEID_INO64_GEN_PARENT are the
values returned by fuse and xfs for 64bit ino encoded file handle types.

Note that these type value are filesystem specific and they do not define
a universal file handle format, for example:
fuse encodes FILEID_INO64_GEN as [ino-hi32,ino-lo32,gen] and xfs encodes
FILEID_INO64_GEN as [hostr-order-ino64,gen] (a.k.a xfs_fid64).

The FILEID_INO64_GEN fhandle type is going to be used for file ids for
fanotify from filesystems that do not support NFS export.

Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://lore.kernel.org/r/20231023180801.2953446-4-amir73il@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/fuse/inode.c
include/linux/exportfs.h

index 2e4eb7cf26fb33363698c990a296b50a35aa792b..e63f966698a5acb35d8cb67caaecae5f4bc83ce0 100644 (file)
@@ -1002,7 +1002,7 @@ static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len,
        }
 
        *max_len = len;
-       return parent ? 0x82 : 0x81;
+       return parent ? FILEID_INO64_GEN_PARENT : FILEID_INO64_GEN;
 }
 
 static struct dentry *fuse_fh_to_dentry(struct super_block *sb,
@@ -1010,7 +1010,8 @@ static struct dentry *fuse_fh_to_dentry(struct super_block *sb,
 {
        struct fuse_inode_handle handle;
 
-       if ((fh_type != 0x81 && fh_type != 0x82) || fh_len < 3)
+       if ((fh_type != FILEID_INO64_GEN &&
+            fh_type != FILEID_INO64_GEN_PARENT) || fh_len < 3)
                return NULL;
 
        handle.nodeid = (u64) fid->raw[0] << 32;
@@ -1024,7 +1025,7 @@ static struct dentry *fuse_fh_to_parent(struct super_block *sb,
 {
        struct fuse_inode_handle parent;
 
-       if (fh_type != 0x82 || fh_len < 6)
+       if (fh_type != FILEID_INO64_GEN_PARENT || fh_len < 6)
                return NULL;
 
        parent.nodeid = (u64) fid->raw[3] << 32;
index 85bd027494e5463018b17545896aa98a6a9124ca..4119d3ee72eb184e24548ed84ddaaaceb7ed2ec1 100644 (file)
@@ -98,6 +98,17 @@ enum fid_type {
         */
        FILEID_FAT_WITH_PARENT = 0x72,
 
+       /*
+        * 64 bit inode number, 32 bit generation number.
+        */
+       FILEID_INO64_GEN = 0x81,
+
+       /*
+        * 64 bit inode number, 32 bit generation number,
+        * 64 bit parent inode number, 32 bit parent generation.
+        */
+       FILEID_INO64_GEN_PARENT = 0x82,
+
        /*
         * 128 bit child FID (struct lu_fid)
         * 128 bit parent FID (struct lu_fid)