ChangeSet 1.2317, 2005/03/31 09:00:38-08:00, [EMAIL PROTECTED]
[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 <[EMAIL PROTECTED]>
Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
nfs4acl.c | 3 +++
nfs4xdr.c | 5 ++++-
vfs.c | 7 +++++--
3 files changed, 12 insertions(+), 3 deletions(-)
diff -Nru a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
--- a/fs/nfsd/nfs4acl.c 2005-03-31 10:31:44 -08:00
+++ b/fs/nfsd/nfs4acl.c 2005-03-31 10:31:44 -08:00
@@ -93,6 +93,9 @@
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 -Nru a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
--- a/fs/nfsd/nfs4xdr.c 2005-03-31 10:31:44 -08:00
+++ b/fs/nfsd/nfs4xdr.c 2005-03-31 10:31:44 -08:00
@@ -1331,7 +1331,10 @@
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 -Nru a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
--- a/fs/nfsd/vfs.c 2005-03-31 10:31:44 -08:00
+++ b/fs/nfsd/vfs.c 2005-03-31 10:31:44 -08:00
@@ -393,7 +393,7 @@
}
out:
kfree(buf);
- return (error);
+ return error;
}
int
@@ -417,7 +417,10 @@
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) {
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html