Skip to content

Commit 41d1ddd

Browse files
amir73ilbrauner
authored andcommitted
exportfs: define FILEID_INO64_GEN* file handle types
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 <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Amir Goldstein <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent e21fc20 commit 41d1ddd

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

fs/fuse/inode.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,15 +1002,16 @@ static int fuse_encode_fh(struct inode *inode, u32 *fh, int *max_len,
10021002
}
10031003

10041004
*max_len = len;
1005-
return parent ? 0x82 : 0x81;
1005+
return parent ? FILEID_INO64_GEN_PARENT : FILEID_INO64_GEN;
10061006
}
10071007

10081008
static struct dentry *fuse_fh_to_dentry(struct super_block *sb,
10091009
struct fid *fid, int fh_len, int fh_type)
10101010
{
10111011
struct fuse_inode_handle handle;
10121012

1013-
if ((fh_type != 0x81 && fh_type != 0x82) || fh_len < 3)
1013+
if ((fh_type != FILEID_INO64_GEN &&
1014+
fh_type != FILEID_INO64_GEN_PARENT) || fh_len < 3)
10141015
return NULL;
10151016

10161017
handle.nodeid = (u64) fid->raw[0] << 32;
@@ -1024,7 +1025,7 @@ static struct dentry *fuse_fh_to_parent(struct super_block *sb,
10241025
{
10251026
struct fuse_inode_handle parent;
10261027

1027-
if (fh_type != 0x82 || fh_len < 6)
1028+
if (fh_type != FILEID_INO64_GEN_PARENT || fh_len < 6)
10281029
return NULL;
10291030

10301031
parent.nodeid = (u64) fid->raw[3] << 32;

include/linux/exportfs.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ enum fid_type {
9898
*/
9999
FILEID_FAT_WITH_PARENT = 0x72,
100100

101+
/*
102+
* 64 bit inode number, 32 bit generation number.
103+
*/
104+
FILEID_INO64_GEN = 0x81,
105+
106+
/*
107+
* 64 bit inode number, 32 bit generation number,
108+
* 64 bit parent inode number, 32 bit parent generation.
109+
*/
110+
FILEID_INO64_GEN_PARENT = 0x82,
111+
101112
/*
102113
* 128 bit child FID (struct lu_fid)
103114
* 128 bit parent FID (struct lu_fid)

0 commit comments

Comments
 (0)