瀏覽代碼

[PATCH] knfsd: nfsd4: better nfs4acl errors

We're returning -1 in a few places in the NFSv4<->POSIX acl translation code
where we could return a reasonable error.

Also allows some minor simplification elsewhere.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
NeilBrown 19 年之前
父節點
當前提交
b905b7b0a0
共有 2 個文件被更改,包括 6 次插入7 次删除
  1. 3 3
      fs/nfsd/nfs4acl.c
  2. 3 4
      fs/nfsd/nfs4xdr.c

+ 3 - 3
fs/nfsd/nfs4acl.c

@@ -710,9 +710,9 @@ calculate_posix_ace_count(struct nfs4_acl *n4acl)
 		/* Also, the remaining entries are for named users and
 		/* Also, the remaining entries are for named users and
 		 * groups, and come in threes (mask, allow, deny): */
 		 * groups, and come in threes (mask, allow, deny): */
 		if (n4acl->naces < 7)
 		if (n4acl->naces < 7)
-			return -1;
+			return -EINVAL;
 		if ((n4acl->naces - 7) % 3)
 		if ((n4acl->naces - 7) % 3)
-			return -1;
+			return -EINVAL;
 		return 4 + (n4acl->naces - 7)/3;
 		return 4 + (n4acl->naces - 7)/3;
 	}
 	}
 }
 }
@@ -866,7 +866,7 @@ nfs4_acl_add_ace(struct nfs4_acl *acl, u32 type, u32 flag, u32 access_mask,
 	struct nfs4_ace *ace;
 	struct nfs4_ace *ace;
 
 
 	if ((ace = kmalloc(sizeof(*ace), GFP_KERNEL)) == NULL)
 	if ((ace = kmalloc(sizeof(*ace), GFP_KERNEL)) == NULL)
-		return -1;
+		return -ENOMEM;
 
 
 	ace->type = type;
 	ace->type = type;
 	ace->flag = flag;
 	ace->flag = flag;

+ 3 - 4
fs/nfsd/nfs4xdr.c

@@ -299,11 +299,10 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
 						buf, dummy32, &ace.who);
 						buf, dummy32, &ace.who);
 			if (status)
 			if (status)
 				goto out_nfserr;
 				goto out_nfserr;
-			if (nfs4_acl_add_ace(*acl, ace.type, ace.flag,
-				 ace.access_mask, ace.whotype, ace.who) != 0) {
-				status = -ENOMEM;
+			status = nfs4_acl_add_ace(*acl, ace.type, ace.flag,
+				 ace.access_mask, ace.whotype, ace.who);
+			if (status)
 				goto out_nfserr;
 				goto out_nfserr;
-			}
 		}
 		}
 	} else
 	} else
 		*acl = NULL;
 		*acl = NULL;