@@ -1105,6 +1105,7 @@ static struct flags {
{ NFSEXP_V4ROOT, {"v4root", ""}},
{ NFSEXP_PNFS, {"pnfs", ""}},
{ NFSEXP_SECURITY_LABEL, {"security_label", ""}},
+ { NFSEXP_NOUSERXATTR, {"no_userxattr", ""}},
{ 0, {"", ""}}
};
@@ -3154,8 +3154,11 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
p = xdr_reserve_space(xdr, 4);
if (!p)
goto out_resource;
- err = xattr_supported_namespace(d_inode(dentry),
- XATTR_USER_PREFIX);
+ if (exp->ex_flags & NFSEXP_NOUSERXATTR)
+ err = -EOPNOTSUPP;
+ else
+ err = xattr_supported_namespace(d_inode(dentry),
+ XATTR_USER_PREFIX);
*p++ = cpu_to_be32(err == 0);
}
#endif
@@ -2046,6 +2046,9 @@ nfsd_getxattr(struct svc_rqst *rqstp, struct svc_fh *fhp, char *name, void *buf,
if (err)
return err;
+ if (fhp->fh_export->ex_flags & NFSEXP_NOUSERXATTR)
+ return nfserr_opnotsupp;
+
lerr = vfs_getxattr(fhp->fh_dentry, name, buf, *lenp);
if (lerr < 0)
err = nfsd_xattr_errno(lerr);
@@ -2065,6 +2068,9 @@ nfsd_listxattr(struct svc_rqst *rqstp, struct svc_fh *fhp, void *buf, int *lenp)
if (err)
return err;
+ if (fhp->fh_export->ex_flags & NFSEXP_NOUSERXATTR)
+ return nfserr_opnotsupp;
+
lerr = vfs_listxattr(fhp->fh_dentry, buf, *lenp);
if (lerr < 0)
@@ -2092,6 +2098,9 @@ nfsd_removexattr(struct svc_rqst *rqstp, struct svc_fh *fhp, char *name)
if (err)
return err;
+ if (fhp->fh_export->ex_flags & NFSEXP_NOUSERXATTR)
+ return nfserr_opnotsupp;
+
ret = fh_want_write(fhp);
if (ret)
return nfserrno(ret);
@@ -2116,6 +2125,9 @@ nfsd_setxattr(struct svc_rqst *rqstp, struct svc_fh *fhp, char *name,
if (err)
return err;
+ if (fhp->fh_export->ex_flags & NFSEXP_NOUSERXATTR)
+ return nfserr_opnotsupp;
+
ret = fh_want_write(fhp);
if (ret)
return nfserrno(ret);
@@ -53,9 +53,10 @@
*/
#define NFSEXP_V4ROOT 0x10000
#define NFSEXP_PNFS 0x20000
+#define NFSEXP_NOUSERXATTR 0x40000
/* All flags that we claim to support. (Note we don't support NOACL.) */
-#define NFSEXP_ALLFLAGS 0x3FEFF
+#define NFSEXP_ALLFLAGS 0x7FEFF
/* The flags that may vary depending on security flavor: */
#define NFSEXP_SECINFO_FLAGS (NFSEXP_READONLY | NFSEXP_ROOTSQUASH \
Like with some other features, add a flag that allows a filesystem to be exported without extended user attribute support, even if support is compiled in. Signed-off-by: Frank van der Linden <fllinden@amazon.com> --- fs/nfsd/export.c | 1 + fs/nfsd/nfs4xdr.c | 7 +++++-- fs/nfsd/vfs.c | 12 ++++++++++++ include/uapi/linux/nfsd/export.h | 3 ++- 4 files changed, 20 insertions(+), 3 deletions(-)