aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2006-10-20 02:29:01 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-20 13:26:43 -0400
commitb8dd7b9ab194d9ab322881f49fde42954757efae (patch)
tree2709bca272730c061faee95bbbcac12343968de3 /fs
parentc4d987ba841dff4b2fc768e52d1d95af83f9f157 (diff)
[PATCH] nfsd: NFSv4 errno endianness annotations
don't use the same variable to store NFS and host error values Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no> Acked-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4state.c15
-rw-r--r--fs/nfsd/nfs4xdr.c42
2 files changed, 31 insertions, 26 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index e5ca6d7028df..ae1d47715b90 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2646,6 +2646,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2646 struct file_lock conflock; 2646 struct file_lock conflock;
2647 __be32 status = 0; 2647 __be32 status = 0;
2648 unsigned int strhashval; 2648 unsigned int strhashval;
2649 int err;
2649 2650
2650 dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n", 2651 dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n",
2651 (long long) lock->lk_offset, 2652 (long long) lock->lk_offset,
@@ -2758,13 +2759,14 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2758 * locks_copy_lock: */ 2759 * locks_copy_lock: */
2759 conflock.fl_ops = NULL; 2760 conflock.fl_ops = NULL;
2760 conflock.fl_lmops = NULL; 2761 conflock.fl_lmops = NULL;
2761 status = posix_lock_file_conf(filp, &file_lock, &conflock); 2762 err = posix_lock_file_conf(filp, &file_lock, &conflock);
2762 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status); 2763 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status);
2763 switch (-status) { 2764 switch (-err) {
2764 case 0: /* success! */ 2765 case 0: /* success! */
2765 update_stateid(&lock_stp->st_stateid); 2766 update_stateid(&lock_stp->st_stateid);
2766 memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid, 2767 memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid,
2767 sizeof(stateid_t)); 2768 sizeof(stateid_t));
2769 status = 0;
2768 break; 2770 break;
2769 case (EAGAIN): /* conflock holds conflicting lock */ 2771 case (EAGAIN): /* conflock holds conflicting lock */
2770 status = nfserr_denied; 2772 status = nfserr_denied;
@@ -2775,7 +2777,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2775 status = nfserr_deadlock; 2777 status = nfserr_deadlock;
2776 break; 2778 break;
2777 default: 2779 default:
2778 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",status); 2780 dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",err);
2779 status = nfserr_resource; 2781 status = nfserr_resource;
2780 break; 2782 break;
2781 } 2783 }
@@ -2880,6 +2882,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2880 struct file *filp = NULL; 2882 struct file *filp = NULL;
2881 struct file_lock file_lock; 2883 struct file_lock file_lock;
2882 __be32 status; 2884 __be32 status;
2885 int err;
2883 2886
2884 dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n", 2887 dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n",
2885 (long long) locku->lu_offset, 2888 (long long) locku->lu_offset,
@@ -2917,8 +2920,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2917 /* 2920 /*
2918 * Try to unlock the file in the VFS. 2921 * Try to unlock the file in the VFS.
2919 */ 2922 */
2920 status = posix_lock_file(filp, &file_lock); 2923 err = posix_lock_file(filp, &file_lock);
2921 if (status) { 2924 if (err) {
2922 dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n"); 2925 dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n");
2923 goto out_nfserr; 2926 goto out_nfserr;
2924 } 2927 }
@@ -2937,7 +2940,7 @@ out:
2937 return status; 2940 return status;
2938 2941
2939out_nfserr: 2942out_nfserr:
2940 status = nfserrno(status); 2943 status = nfserrno(err);
2941 goto out; 2944 goto out;
2942} 2945}
2943 2946
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;