Commit 0c9d65e7 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by J. Bruce Fields

nfsd: Checking for acl support does not require fetching any acls

Whether or not a file system supports acls can be determined with
IS_POSIXACL(inode) and does not require trying to fetch any acls; the code for
computing the supported_attrs and aclsupport attributes can be simplified.
Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent cc265089
...@@ -2227,7 +2227,6 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, ...@@ -2227,7 +2227,6 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
u32 rdattr_err = 0; u32 rdattr_err = 0;
__be32 status; __be32 status;
int err; int err;
int aclsupport = 0;
struct nfs4_acl *acl = NULL; struct nfs4_acl *acl = NULL;
void *context = NULL; void *context = NULL;
int contextlen; int contextlen;
...@@ -2274,11 +2273,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, ...@@ -2274,11 +2273,8 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
goto out; goto out;
fhp = tempfh; fhp = tempfh;
} }
if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
| FATTR4_WORD0_SUPPORTED_ATTRS)) {
err = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
aclsupport = (err == 0);
if (bmval0 & FATTR4_WORD0_ACL) { if (bmval0 & FATTR4_WORD0_ACL) {
err = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
if (err == -EOPNOTSUPP) if (err == -EOPNOTSUPP)
bmval0 &= ~FATTR4_WORD0_ACL; bmval0 &= ~FATTR4_WORD0_ACL;
else if (err == -EINVAL) { else if (err == -EINVAL) {
...@@ -2287,7 +2283,6 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, ...@@ -2287,7 +2283,6 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
} else if (err != 0) } else if (err != 0)
goto out_nfserr; goto out_nfserr;
} }
}
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL #ifdef CONFIG_NFSD_V4_SECURITY_LABEL
if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) || if ((bmval[2] & FATTR4_WORD2_SECURITY_LABEL) ||
...@@ -2338,7 +2333,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, ...@@ -2338,7 +2333,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
u32 word1 = nfsd_suppattrs1(minorversion); u32 word1 = nfsd_suppattrs1(minorversion);
u32 word2 = nfsd_suppattrs2(minorversion); u32 word2 = nfsd_suppattrs2(minorversion);
if (!aclsupport) if (!IS_POSIXACL(dentry->d_inode))
word0 &= ~FATTR4_WORD0_ACL; word0 &= ~FATTR4_WORD0_ACL;
if (!contextsupport) if (!contextsupport)
word2 &= ~FATTR4_WORD2_SECURITY_LABEL; word2 &= ~FATTR4_WORD2_SECURITY_LABEL;
...@@ -2486,7 +2481,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp, ...@@ -2486,7 +2481,7 @@ nfsd4_encode_fattr(struct xdr_stream *xdr, struct svc_fh *fhp,
p = xdr_reserve_space(xdr, 4); p = xdr_reserve_space(xdr, 4);
if (!p) if (!p)
goto out_resource; goto out_resource;
*p++ = cpu_to_be32(aclsupport ? *p++ = cpu_to_be32(IS_POSIXACL(dentry->d_inode) ?
ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL : 0); ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL : 0);
} }
if (bmval0 & FATTR4_WORD0_CANSETTIME) { if (bmval0 & FATTR4_WORD0_CANSETTIME) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment