Unverified Commit e21fc203 authored by Amir Goldstein's avatar Amir Goldstein Committed by Christian Brauner
Browse files

exportfs: make ->encode_fh() a mandatory method for NFS export



Rename the default helper for encoding FILEID_INO32_GEN* file handles to
generic_encode_ino32_fh() and convert the filesystems that used the
default implementation to use the generic helper explicitly.

After this change, exportfs_encode_inode_fh() no longer has a default
implementation to encode FILEID_INO32_GEN* file handles.

This is a step towards allowing filesystems to encode non-decodeable
file handles for fanotify without having to implement any
export_operations.

Reviewed-by: default avatarJan Kara <jack@suse.cz>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Acked-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Link: https://lore.kernel.org/r/20231023180801.2953446-3-amir73il@gmail.com


Acked-by: default avatarDave Kleikamp <dave.kleikamp@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 66c62769
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -122,12 +122,9 @@ are exportable by setting the s_export_op field in the struct
super_block.  This field must point to a "struct export_operations"
struct which has the following members:

  encode_fh (optional)
  encode_fh (mandatory)
    Takes a dentry and creates a filehandle fragment which may later be used
    to find or create a dentry for the same object.  The default
    implementation creates a filehandle fragment that encodes a 32bit inode
    and generation number for the inode encoded, and if necessary the
    same information for the parent.
    to find or create a dentry for the same object.

  fh_to_dentry (mandatory)
    Given a filehandle fragment, this should find the implied object and
+9 −0
Original line number Diff line number Diff line
@@ -1045,3 +1045,12 @@ filesystem type is now moved to a later point when the devices are closed:
As this is a VFS level change it has no practical consequences for filesystems
other than that all of them must use one of the provided kill_litter_super(),
kill_anon_super(), or kill_block_super() helpers.

---

**mandatory**

export_operations ->encode_fh() no longer has a default implementation to
encode FILEID_INO32_GEN* file handles.
Filesystems that used the default implementation may use the generic helper
generic_encode_ino32_fh() explicitly.
+1 −0
Original line number Diff line number Diff line
@@ -568,6 +568,7 @@ static struct dentry *affs_fh_to_parent(struct super_block *sb, struct fid *fid,
}

const struct export_operations affs_export_ops = {
	.encode_fh = generic_encode_ino32_fh,
	.fh_to_dentry = affs_fh_to_dentry,
	.fh_to_parent = affs_fh_to_parent,
	.get_parent = affs_get_parent,
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ static const struct address_space_operations befs_symlink_aops = {
};

static const struct export_operations befs_export_operations = {
	.encode_fh	= generic_encode_ino32_fh,
	.fh_to_dentry	= befs_fh_to_dentry,
	.fh_to_parent	= befs_fh_to_parent,
	.get_parent	= befs_get_parent,
+1 −0
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ static const struct super_operations efs_superblock_operations = {
};

static const struct export_operations efs_export_ops = {
	.encode_fh	= generic_encode_ino32_fh,
	.fh_to_dentry	= efs_fh_to_dentry,
	.fh_to_parent	= efs_fh_to_parent,
	.get_parent	= efs_get_parent,
Loading