[RFC PATCH 04/35] nfs: parse the {no}user_xattr option

Frank van der Linden
2019-09-12T17:29:05Z

Parse the {no}user_xattr option to enable the optional NFS4.2 user
extended attribute support.

Signed-off-by: Frank van der Linden <fllinden@amazon.com>
---
fs/nfs/super.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 703f595dce90..bbb93bc87887 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -93,6 +93,7 @@ enum {
Opt_resvport, Opt_noresvport,
Opt_fscache, Opt_nofscache,
Opt_migration, Opt_nomigration,
+ Opt_user_xattr, Opt_nouser_xattr,

/* Mount options that take integer arguments */
Opt_port,
@@ -190,6 +191,9 @@ static const match_table_t nfs_mount_option_tokens = {
{ Opt_fscache_uniq, "fsc=%s" },
{ Opt_local_lock, "local_lock=%s" },

+ { Opt_user_xattr, "user_xattr" },
+ { Opt_nouser_xattr, "nouser_xattr" },
+
/* The following needs to be listed after all other options */
{ Opt_nfsvers, "v%s" },

@@ -643,6 +647,7 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
{ NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" },
{ NFS_MOUNT_UNSHARED, ",nosharecache", "" },
{ NFS_MOUNT_NORESVPORT, ",noresvport", "" },
+ { NFS_MOUNT_USER_XATTR, ",user_xattr", "" },
{ 0, NULL, NULL }
};
const struct proc_nfs_info *nfs_infop;
@@ -1316,6 +1321,12 @@ static int nfs_parse_mount_options(char *raw,
case Opt_noacl:
mnt->flags |= NFS_MOUNT_NOACL;
break;
+ case Opt_user_xattr:
+ mnt->flags |= NFS_MOUNT_USER_XATTR;
+ break;
+ case Opt_nouser_xattr:
+ mnt->flags &= ~NFS_MOUNT_USER_XATTR;
+ break;
case Opt_rdirplus:
mnt->flags &= ~NFS_MOUNT_NORDIRPLUS;
break;
--
2.17.2