Commit 14168d67 authored by Chuck Lever's avatar Chuck Lever Committed by J. Bruce Fields

NFSD: Remove the RETURN_STATUS() macro

Refactor: I'm about to change the return value from .pc_func. Clear
the way by replacing the RETURN_STATUS() macro with logic that
plants the status code directly into the response structure.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent f0af2210
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "xdr3.h" #include "xdr3.h"
#include "vfs.h" #include "vfs.h"
#define RETURN_STATUS(st) { resp->status = (st); return (st); }
/* /*
* NULL call. * NULL call.
*/ */
...@@ -34,17 +32,18 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst *rqstp) ...@@ -34,17 +32,18 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst *rqstp)
struct posix_acl *acl; struct posix_acl *acl;
struct inode *inode; struct inode *inode;
svc_fh *fh; svc_fh *fh;
__be32 nfserr = 0;
fh = fh_copy(&resp->fh, &argp->fh); fh = fh_copy(&resp->fh, &argp->fh);
nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP);
if (nfserr) if (resp->status != nfs_ok)
RETURN_STATUS(nfserr); goto out;
inode = d_inode(fh->fh_dentry); inode = d_inode(fh->fh_dentry);
if (argp->mask & ~NFS_ACL_MASK) if (argp->mask & ~NFS_ACL_MASK) {
RETURN_STATUS(nfserr_inval); resp->status = nfserr_inval;
goto out;
}
resp->mask = argp->mask; resp->mask = argp->mask;
if (resp->mask & (NFS_ACL|NFS_ACLCNT)) { if (resp->mask & (NFS_ACL|NFS_ACLCNT)) {
...@@ -54,7 +53,7 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst *rqstp) ...@@ -54,7 +53,7 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst *rqstp)
acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL); acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
} }
if (IS_ERR(acl)) { if (IS_ERR(acl)) {
nfserr = nfserrno(PTR_ERR(acl)); resp->status = nfserrno(PTR_ERR(acl));
goto fail; goto fail;
} }
resp->acl_access = acl; resp->acl_access = acl;
...@@ -64,19 +63,20 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst *rqstp) ...@@ -64,19 +63,20 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst *rqstp)
of a non-directory! */ of a non-directory! */
acl = get_acl(inode, ACL_TYPE_DEFAULT); acl = get_acl(inode, ACL_TYPE_DEFAULT);
if (IS_ERR(acl)) { if (IS_ERR(acl)) {
nfserr = nfserrno(PTR_ERR(acl)); resp->status = nfserrno(PTR_ERR(acl));
goto fail; goto fail;
} }
resp->acl_default = acl; resp->acl_default = acl;
} }
/* resp->acl_{access,default} are released in nfs3svc_release_getacl. */ /* resp->acl_{access,default} are released in nfs3svc_release_getacl. */
RETURN_STATUS(0); out:
return resp->status;
fail: fail:
posix_acl_release(resp->acl_access); posix_acl_release(resp->acl_access);
posix_acl_release(resp->acl_default); posix_acl_release(resp->acl_default);
RETURN_STATUS(nfserr); goto out;
} }
/* /*
...@@ -88,12 +88,11 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp) ...@@ -88,12 +88,11 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
struct nfsd3_attrstat *resp = rqstp->rq_resp; struct nfsd3_attrstat *resp = rqstp->rq_resp;
struct inode *inode; struct inode *inode;
svc_fh *fh; svc_fh *fh;
__be32 nfserr = 0;
int error; int error;
fh = fh_copy(&resp->fh, &argp->fh); fh = fh_copy(&resp->fh, &argp->fh);
nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR); resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR);
if (nfserr) if (resp->status != nfs_ok)
goto out; goto out;
inode = d_inode(fh->fh_dentry); inode = d_inode(fh->fh_dentry);
...@@ -113,13 +112,13 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp) ...@@ -113,13 +112,13 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
fh_unlock(fh); fh_unlock(fh);
fh_drop_write(fh); fh_drop_write(fh);
out_errno: out_errno:
nfserr = nfserrno(error); resp->status = nfserrno(error);
out: out:
/* argp->acl_{access,default} may have been allocated in /* argp->acl_{access,default} may have been allocated in
nfs3svc_decode_setaclargs. */ nfs3svc_decode_setaclargs. */
posix_acl_release(argp->acl_access); posix_acl_release(argp->acl_access);
posix_acl_release(argp->acl_default); posix_acl_release(argp->acl_default);
RETURN_STATUS(nfserr); return resp->status;
} }
/* /*
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment