[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>
This commit is contained in:
@@ -2646,6 +2646,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
|
|||||||
struct file_lock conflock;
|
struct file_lock conflock;
|
||||||
__be32 status = 0;
|
__be32 status = 0;
|
||||||
unsigned int strhashval;
|
unsigned int strhashval;
|
||||||
|
int err;
|
||||||
|
|
||||||
dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n",
|
dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n",
|
||||||
(long long) lock->lk_offset,
|
(long long) lock->lk_offset,
|
||||||
@@ -2758,13 +2759,14 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
|
|||||||
* locks_copy_lock: */
|
* locks_copy_lock: */
|
||||||
conflock.fl_ops = NULL;
|
conflock.fl_ops = NULL;
|
||||||
conflock.fl_lmops = NULL;
|
conflock.fl_lmops = NULL;
|
||||||
status = posix_lock_file_conf(filp, &file_lock, &conflock);
|
err = posix_lock_file_conf(filp, &file_lock, &conflock);
|
||||||
dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status);
|
dprintk("NFSD: nfsd4_lock: posix_lock_file_conf status %d\n",status);
|
||||||
switch (-status) {
|
switch (-err) {
|
||||||
case 0: /* success! */
|
case 0: /* success! */
|
||||||
update_stateid(&lock_stp->st_stateid);
|
update_stateid(&lock_stp->st_stateid);
|
||||||
memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid,
|
memcpy(&lock->lk_resp_stateid, &lock_stp->st_stateid,
|
||||||
sizeof(stateid_t));
|
sizeof(stateid_t));
|
||||||
|
status = 0;
|
||||||
break;
|
break;
|
||||||
case (EAGAIN): /* conflock holds conflicting lock */
|
case (EAGAIN): /* conflock holds conflicting lock */
|
||||||
status = nfserr_denied;
|
status = nfserr_denied;
|
||||||
@@ -2775,7 +2777,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
|
|||||||
status = nfserr_deadlock;
|
status = nfserr_deadlock;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",status);
|
dprintk("NFSD: nfsd4_lock: posix_lock_file_conf() failed! status %d\n",err);
|
||||||
status = nfserr_resource;
|
status = nfserr_resource;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2880,6 +2882,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
|
|||||||
struct file *filp = NULL;
|
struct file *filp = NULL;
|
||||||
struct file_lock file_lock;
|
struct file_lock file_lock;
|
||||||
__be32 status;
|
__be32 status;
|
||||||
|
int err;
|
||||||
|
|
||||||
dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n",
|
dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n",
|
||||||
(long long) locku->lu_offset,
|
(long long) locku->lu_offset,
|
||||||
@@ -2917,8 +2920,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
|
|||||||
/*
|
/*
|
||||||
* Try to unlock the file in the VFS.
|
* Try to unlock the file in the VFS.
|
||||||
*/
|
*/
|
||||||
status = posix_lock_file(filp, &file_lock);
|
err = posix_lock_file(filp, &file_lock);
|
||||||
if (status) {
|
if (err) {
|
||||||
dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n");
|
dprintk("NFSD: nfs4_locku: posix_lock_file failed!\n");
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
}
|
}
|
||||||
@@ -2937,7 +2940,7 @@ out:
|
|||||||
return status;
|
return status;
|
||||||
|
|
||||||
out_nfserr:
|
out_nfserr:
|
||||||
status = nfserrno(status);
|
status = nfserrno(err);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -247,6 +247,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
|
|||||||
int expected_len, len = 0;
|
int expected_len, len = 0;
|
||||||
u32 dummy32;
|
u32 dummy32;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
int host_err;
|
||||||
|
|
||||||
DECODE_HEAD;
|
DECODE_HEAD;
|
||||||
iattr->ia_valid = 0;
|
iattr->ia_valid = 0;
|
||||||
@@ -280,7 +281,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
|
|||||||
|
|
||||||
*acl = nfs4_acl_new();
|
*acl = nfs4_acl_new();
|
||||||
if (*acl == NULL) {
|
if (*acl == NULL) {
|
||||||
status = -ENOMEM;
|
host_err = -ENOMEM;
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
}
|
}
|
||||||
defer_free(argp, (void (*)(const void *))nfs4_acl_free, *acl);
|
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
|
|||||||
len += XDR_QUADLEN(dummy32) << 2;
|
len += XDR_QUADLEN(dummy32) << 2;
|
||||||
READMEM(buf, dummy32);
|
READMEM(buf, dummy32);
|
||||||
ace.whotype = nfs4_acl_get_whotype(buf, dummy32);
|
ace.whotype = nfs4_acl_get_whotype(buf, dummy32);
|
||||||
status = 0;
|
host_err = 0;
|
||||||
if (ace.whotype != NFS4_ACL_WHO_NAMED)
|
if (ace.whotype != NFS4_ACL_WHO_NAMED)
|
||||||
ace.who = 0;
|
ace.who = 0;
|
||||||
else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP)
|
else if (ace.flag & NFS4_ACE_IDENTIFIER_GROUP)
|
||||||
status = nfsd_map_name_to_gid(argp->rqstp,
|
host_err = nfsd_map_name_to_gid(argp->rqstp,
|
||||||
buf, dummy32, &ace.who);
|
buf, dummy32, &ace.who);
|
||||||
else
|
else
|
||||||
status = nfsd_map_name_to_uid(argp->rqstp,
|
host_err = nfsd_map_name_to_uid(argp->rqstp,
|
||||||
buf, dummy32, &ace.who);
|
buf, dummy32, &ace.who);
|
||||||
if (status)
|
if (host_err)
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
status = nfs4_acl_add_ace(*acl, ace.type, ace.flag,
|
host_err = nfs4_acl_add_ace(*acl, ace.type, ace.flag,
|
||||||
ace.access_mask, ace.whotype, ace.who);
|
ace.access_mask, ace.whotype, ace.who);
|
||||||
if (status)
|
if (host_err)
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@@ -327,7 +328,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
|
|||||||
READ_BUF(dummy32);
|
READ_BUF(dummy32);
|
||||||
len += (XDR_QUADLEN(dummy32) << 2);
|
len += (XDR_QUADLEN(dummy32) << 2);
|
||||||
READMEM(buf, dummy32);
|
READMEM(buf, dummy32);
|
||||||
if ((status = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid)))
|
if ((host_err = nfsd_map_name_to_uid(argp->rqstp, buf, dummy32, &iattr->ia_uid)))
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
iattr->ia_valid |= ATTR_UID;
|
iattr->ia_valid |= ATTR_UID;
|
||||||
}
|
}
|
||||||
@@ -338,7 +339,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
|
|||||||
READ_BUF(dummy32);
|
READ_BUF(dummy32);
|
||||||
len += (XDR_QUADLEN(dummy32) << 2);
|
len += (XDR_QUADLEN(dummy32) << 2);
|
||||||
READMEM(buf, dummy32);
|
READMEM(buf, dummy32);
|
||||||
if ((status = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid)))
|
if ((host_err = nfsd_map_name_to_gid(argp->rqstp, buf, dummy32, &iattr->ia_gid)))
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
iattr->ia_valid |= ATTR_GID;
|
iattr->ia_valid |= ATTR_GID;
|
||||||
}
|
}
|
||||||
@@ -414,7 +415,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia
|
|||||||
DECODE_TAIL;
|
DECODE_TAIL;
|
||||||
|
|
||||||
out_nfserr:
|
out_nfserr:
|
||||||
status = nfserrno(status);
|
status = nfserrno(host_err);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1438,6 +1439,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
|
|||||||
u32 rdattr_err = 0;
|
u32 rdattr_err = 0;
|
||||||
__be32 *p = buffer;
|
__be32 *p = buffer;
|
||||||
__be32 status;
|
__be32 status;
|
||||||
|
int err;
|
||||||
int aclsupport = 0;
|
int aclsupport = 0;
|
||||||
struct nfs4_acl *acl = NULL;
|
struct nfs4_acl *acl = NULL;
|
||||||
|
|
||||||
@@ -1451,14 +1453,14 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = vfs_getattr(exp->ex_mnt, dentry, &stat);
|
err = vfs_getattr(exp->ex_mnt, dentry, &stat);
|
||||||
if (status)
|
if (err)
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||
|
if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||
|
||||||
(bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
|
(bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
|
||||||
FATTR4_WORD1_SPACE_TOTAL))) {
|
FATTR4_WORD1_SPACE_TOTAL))) {
|
||||||
status = vfs_statfs(dentry, &statfs);
|
err = vfs_statfs(dentry, &statfs);
|
||||||
if (status)
|
if (err)
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
}
|
}
|
||||||
if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) {
|
if ((bmval0 & (FATTR4_WORD0_FILEHANDLE | FATTR4_WORD0_FSID)) && !fhp) {
|
||||||
@@ -1470,15 +1472,15 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
|
|||||||
}
|
}
|
||||||
if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
|
if (bmval0 & (FATTR4_WORD0_ACL | FATTR4_WORD0_ACLSUPPORT
|
||||||
| FATTR4_WORD0_SUPPORTED_ATTRS)) {
|
| FATTR4_WORD0_SUPPORTED_ATTRS)) {
|
||||||
status = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
|
err = nfsd4_get_nfs4_acl(rqstp, dentry, &acl);
|
||||||
aclsupport = (status == 0);
|
aclsupport = (err == 0);
|
||||||
if (bmval0 & FATTR4_WORD0_ACL) {
|
if (bmval0 & FATTR4_WORD0_ACL) {
|
||||||
if (status == -EOPNOTSUPP)
|
if (err == -EOPNOTSUPP)
|
||||||
bmval0 &= ~FATTR4_WORD0_ACL;
|
bmval0 &= ~FATTR4_WORD0_ACL;
|
||||||
else if (status == -EINVAL) {
|
else if (err == -EINVAL) {
|
||||||
status = nfserr_attrnotsupp;
|
status = nfserr_attrnotsupp;
|
||||||
goto out;
|
goto out;
|
||||||
} else if (status != 0)
|
} else if (err != 0)
|
||||||
goto out_nfserr;
|
goto out_nfserr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1818,7 +1820,7 @@ out:
|
|||||||
fh_put(&tempfh);
|
fh_put(&tempfh);
|
||||||
return status;
|
return status;
|
||||||
out_nfserr:
|
out_nfserr:
|
||||||
status = nfserrno(status);
|
status = nfserrno(err);
|
||||||
goto out;
|
goto out;
|
||||||
out_resource:
|
out_resource:
|
||||||
*countp = 0;
|
*countp = 0;
|
||||||
|
Reference in New Issue
Block a user