aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d7b630f1a9ae..f3f239db04bb 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -247,6 +247,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
247 int expected_len, len = 0; 247 int expected_len, len = 0;
248 u32 dummy32; 248 u32 dummy32;
249 char *buf; 249 char *buf;
250 int host_err;
250 251
251 DECODE_HEAD; 252 DECODE_HEAD;
252 iattr->ia_valid = 0; 253 iattr->ia_valid = 0;
@@ -280,7 +281,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
280 281
281 *acl = nfs4_acl_new(); 282 *acl = nfs4_acl_new();
282 if (*acl == NULL) { 283 if (*acl == NULL) {
283 status = -ENOMEM; 284 host_err = -ENOMEM;
284 goto out_nfserr; 285 goto out_nfserr;
285 } 286 }
286 defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl); 287 defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl);
@@ -295,20 +296,20 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
295 len += XDR_QUADLEN(dummy32) << 2; 296 len += XDR_QUADLEN(dummy32) << 2;
296 READMEM(buf, dummy32); 297 READMEM(buf, dummy32);
297 ace.whotype = nfs4_acl_get_whotype(buf, dummy32); 298 ace.whotype = nfs4_acl_get_whotype(buf, dummy32);
298 status = 0; 299 host_err = 0;
299 if (ace.whotype != NFS4_ACL_WHO_NAMED) 300 if (ace.whotype != NFS4_ACL_WHO_NAMED)
300 ace.who = 0; 301 ace.who = 0;
301 else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP) 302 else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP)
302 status = nfsd_map_name_to_gid(argp->rqstp, 303 host_err = nfsd_map_name_to_gid(argp->rqstp,
303 buf, dummy32, &ace.who); 304 buf, dummy32, &ace.who);
304 else 305 else
305 status = nfsd_map_name_to_uid(argp->rqstp, 306 host_err = nfsd_map_name_to_uid(argp->rqstp,
306 buf, dummy32, &ace.who); 307 buf, dummy32, &ace.who);
307 if (status) 308 if (host_err)
308 goto out_nfserr; 309 goto out_nfserr;
309 status = nfs4_acl_add_ace(*acl, ace.type, ace.flag, 310 host_err = nfs4_acl_add_ace(*acl, ace.type, ace.flag,
310 ace.access_mask, ace.whotype, ace.who); 311 ace.access_mask, ace.whotype, ace.who);
311 if (status) 312 if (host_err)
312 goto out_nfserr; 313 goto out_nfserr;
313 } 314 }
314 } else 315 } else
@@ -327,7 +328,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
327 READ_BUF(dummy32); 328 READ_BUF(dummy32);
328 len += (XDR_QUADLEN(dummy32) << 2); 329 len += (XDR_QUADLEN(dummy32) << 2);
329 READMEM(buf, dummy32); 330 READMEM(buf, dummy32);
330 if ((status = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid))) 331 if ((host_err = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid)))
331 goto out_nfserr; 332 goto out_nfserr;
332 iattr->ia_valid |= ATTR_UID; 333 iattr->ia_valid |= ATTR_UID;
333 } 334 }
@@ -338,7 +339,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
338 READ_BUF(dummy32); 339 READ_BUF(dummy32);
339 len += (XDR_QUADLEN(dummy32) << 2); 340 len += (XDR_QUADLEN(dummy32) << 2);
340 READMEM(buf, dummy32); 341 READMEM(buf, dummy32);
341 if ((status = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid))) 342 if ((host_err = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid)))
342 goto out_nfserr; 343 goto out_nfserr;
343 iattr->ia_valid |= ATTR_GID; 344 iattr->ia_valid |= ATTR_GID;
344 } 345 }
@@ -414,7 +415,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
414 DECODE_TAIL; 415 DECODE_TAIL;
415 416
416out_nfserr: 417out_nfserr:
417 status = nfserrno(status); 418 status = nfserrno(host_err);
418 goto out; 419 goto out;
419} 420}
420 421
@@ -1438,6 +1439,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1438 u32 rdattr_err = 0; 1439 u32 rdattr_err = 0;
1439 __be32 *p = buffer; 1440 __be32 *p = buffer;
1440 __be32 status; 1441 __be32 status;
1442 int err;
1441 int aclsupport = 0; 1443 int aclsupport = 0;
1442 struct nfs4_acl *acl = NULL; 1444 struct nfs4_acl *acl = NULL;
1443 1445
@@ -1451,14 +1453,14 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1451 goto out; 1453 goto out;
1452 } 1454 }
1453 1455
1454 status = vfs_getattr(exp->ex_mnt, dentry, &stat); 1456 err = vfs_getattr(exp->ex_mnt, dentry, &stat);
1455 if (status) 1457 if (err)
1456 goto out_nfserr; 1458 goto out_nfserr;
1457 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) || 1459 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||
1458 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE | 1460 (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
1459 FATTR4_WORD1_SPACE_TOTAL))) { 1461 FATTR4_WORD1_SPACE_TOTAL))) {
1460 status = vfs_statfs(dentry, &statfs); 1462 err = vfs_statfs(dentry, &statfs);
1461 if (status) 1463 if (err)
1462 goto out_nfserr; 1464 goto out_nfserr;
1463 } 1465 }
1464 if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) { 1466 if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) {
@@ -1470,15 +1472,15 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1470 } 1472 }
1471 if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT 1473 if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
1472 | FATTR4_WORD0_SUPPORTED_ATTRS)) { 1474 | FATTR4_WORD0_SUPPORTED_ATTRS)) {
1473 status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl); 1475 err = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
1474 aclsupport = (status == 0); 1476 aclsupport = (err == 0);
1475 if (bmval0 & FATTR4_WORD0_ACL) { 1477 if (bmval0 & FATTR4_WORD0_ACL) {
1476 if (status == -EOPNOTSUPP) 1478 if (err == -EOPNOTSUPP)
1477 bmval0 &= ~FATTR4_WORD0_ACL; 1479 bmval0 &= ~FATTR4_WORD0_ACL;
1478 else if (status == -EINVAL) { 1480 else if (err == -EINVAL) {
1479 status = nfserr_attrnotsupp; 1481 status = nfserr_attrnotsupp;
1480 goto out; 1482 goto out;
1481 } else if (status != 0) 1483 } else if (err != 0)
1482 goto out_nfserr; 1484 goto out_nfserr;
1483 } 1485 }
1484 } 1486 }
@@ -1818,7 +1820,7 @@ out:
1818 fh_put(&tempfh); 1820 fh_put(&tempfh);
1819 return status; 1821 return status;
1820out_nfserr: 1822out_nfserr:
1821 status = nfserrno(status); 1823 status = nfserrno(err);
1822 goto out; 1824 goto out;
1823out_resource: 1825out_resource:
1824 *countp = 0; 1826 *countp = 0;