Commit 45fa064d authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] knfsd: nfsd4: Support acl_support attribute

The nfs4 attributes supported_attrs and aclsupport should not be static; they
need to depend on the exported filesystem's acl support.  Test the latter by
attempting to get an acl, and adjust the returned attributes apropriately.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 246b1fd0
...@@ -1414,6 +1414,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, ...@@ -1414,6 +1414,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
u64 dummy64; u64 dummy64;
u32 *p = buffer; u32 *p = buffer;
int status; int status;
int aclsupport = 0;
struct nfs4_acl *acl = NULL; struct nfs4_acl *acl = NULL;
BUG_ON(bmval1 & NFSD_WRITEONLY_ATTRS_WORD1); BUG_ON(bmval1 & NFSD_WRITEONLY_ATTRS_WORD1);
...@@ -1437,13 +1438,17 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, ...@@ -1437,13 +1438,17 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
goto out; goto out;
fhp = &tempfh; fhp = &tempfh;
} }
if (bmval0 & FATTR4_WORD0_ACL) { if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
| FATTR4_WORD0_SUPPORTED_ATTRS)) {
status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl); status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
aclsupport = (status == 0);
if (bmval0 & FATTR4_WORD0_ACL) {
if (status == -EOPNOTSUPP) if (status == -EOPNOTSUPP)
bmval0 &= ~FATTR4_WORD0_ACL; bmval0 &= ~FATTR4_WORD0_ACL;
else if (status < 0) else if (status != 0)
goto out_nfserr; goto out_nfserr;
} }
}
if ((buflen -= 16) < 0) if ((buflen -= 16) < 0)
goto out_resource; goto out_resource;
...@@ -1456,9 +1461,9 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, ...@@ -1456,9 +1461,9 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
if ((buflen -= 12) < 0) if ((buflen -= 12) < 0)
goto out_resource; goto out_resource;
WRITE32(2); WRITE32(2);
/* XXX Should depend on exported filesystem (e.g. WRITE32(aclsupport ?
* for acl support) */ NFSD_SUPPORTED_ATTRS_WORD0 :
WRITE32(NFSD_SUPPORTED_ATTRS_WORD0); NFSD_SUPPORTED_ATTRS_WORD0 & ~FATTR4_WORD0_ACL);
WRITE32(NFSD_SUPPORTED_ATTRS_WORD1); WRITE32(NFSD_SUPPORTED_ATTRS_WORD1);
} }
if (bmval0 & FATTR4_WORD0_TYPE) { if (bmval0 & FATTR4_WORD0_TYPE) {
...@@ -1565,8 +1570,8 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, ...@@ -1565,8 +1570,8 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
if (bmval0 & FATTR4_WORD0_ACLSUPPORT) { if (bmval0 & FATTR4_WORD0_ACLSUPPORT) {
if ((buflen -= 4) < 0) if ((buflen -= 4) < 0)
goto out_resource; goto out_resource;
/* XXX: should depend on exported filesystem: */ WRITE32(aclsupport ?
WRITE32(ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL); ACL4_SUPPORT_ALLOW_ACL|ACL4_SUPPORT_DENY_ACL : 0);
} }
if (bmval0 & FATTR4_WORD0_CANSETTIME) { if (bmval0 & FATTR4_WORD0_CANSETTIME) {
if ((buflen -= 4) < 0) if ((buflen -= 4) < 0)
......
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