diff options
author | Neil Brown <neilb@cse.unsw.edu.au> | 2005-03-30 17:00:38 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-03-30 17:00:38 -0800 |
commit | 6785603ff6ee4c3500ffc78fdeee0f59ace3591b (patch) | |
tree | 3575b5b45f214c41153c0658b866b21696c5e07e | |
parent | 05446e455e965f635e4ee00f0b678c9d07a3790e (diff) | |
download | history-6785603ff6ee4c3500ffc78fdeee0f59ace3591b.tar.gz |
[PATCH] nfsd4: acl error fix
When a client sends an ACL that is a legal NFSv4 ACL, but that we don't
support (because we can't represent it using a POSIX ACL), the correct error
to return is NFS4ERR_ATTRNOTSUPP.
(rfc3530, section 5.11.1: "If the server recieves a request to set an ACE that
it cannot store, it MUST reject the request with NFS4ERR_ATTRNOTSUPP. If the
server receives a request to set an ACE that it can store but cannot enforce,
the server SHOULD reject the request with NFS4ERR_ATTRNOTSUPP").
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/nfsd/nfs4acl.c | 3 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 5 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 7 |
3 files changed, 12 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c index 9f17b64779f69a..11ebf6c4aa54c5 100644 --- a/fs/nfsd/nfs4acl.c +++ b/fs/nfsd/nfs4acl.c @@ -93,6 +93,9 @@ deny_mask(u32 allow_mask, unsigned int flags) return ret; } +/* XXX: modify functions to return NFS errors; they're only ever + * used by nfs code, after all.... */ + static int mode_from_nfs4(u32 perm, unsigned short *mode, unsigned int flags) { diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index f5e1833094dbce..36a058a112d57e 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -1331,7 +1331,10 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, if (bmval0 & FATTR4_WORD0_ACL) { if (status == -EOPNOTSUPP) bmval0 &= ~FATTR4_WORD0_ACL; - else if (status != 0) + else if (status == -EINVAL) { + status = nfserr_attrnotsupp; + goto out; + } else if (status != 0) goto out_nfserr; } } diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 0fc725c3bd45c0..e3e9d217236e46 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -393,7 +393,7 @@ set_nfsv4_acl_one(struct dentry *dentry, struct posix_acl *pacl, char *key) } out: kfree(buf); - return (error); + return error; } int @@ -417,7 +417,10 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, flags = NFS4_ACL_DIR; error = nfs4_acl_nfsv4_to_posix(acl, &pacl, &dpacl, flags); - if (error < 0) + if (error == -EINVAL) { + error = nfserr_attrnotsupp; + goto out; + } else if (error < 0) goto out_nfserr; if (pacl) { |