| .. | .. |
|---|
| 13 | 13 | #include "xdr3.h" |
|---|
| 14 | 14 | #include "vfs.h" |
|---|
| 15 | 15 | |
|---|
| 16 | | -#define RETURN_STATUS(st) { resp->status = (st); return (st); } |
|---|
| 17 | | - |
|---|
| 18 | 16 | /* |
|---|
| 19 | 17 | * NULL call. |
|---|
| 20 | 18 | */ |
|---|
| 21 | 19 | static __be32 |
|---|
| 22 | 20 | nfsd3_proc_null(struct svc_rqst *rqstp) |
|---|
| 23 | 21 | { |
|---|
| 24 | | - return nfs_ok; |
|---|
| 22 | + return rpc_success; |
|---|
| 25 | 23 | } |
|---|
| 26 | 24 | |
|---|
| 27 | 25 | /* |
|---|
| .. | .. |
|---|
| 34 | 32 | struct posix_acl *acl; |
|---|
| 35 | 33 | struct inode *inode; |
|---|
| 36 | 34 | svc_fh *fh; |
|---|
| 37 | | - __be32 nfserr = 0; |
|---|
| 38 | 35 | |
|---|
| 39 | 36 | fh = fh_copy(&resp->fh, &argp->fh); |
|---|
| 40 | | - nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); |
|---|
| 41 | | - if (nfserr) |
|---|
| 42 | | - RETURN_STATUS(nfserr); |
|---|
| 37 | + resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); |
|---|
| 38 | + if (resp->status != nfs_ok) |
|---|
| 39 | + goto out; |
|---|
| 43 | 40 | |
|---|
| 44 | 41 | inode = d_inode(fh->fh_dentry); |
|---|
| 45 | 42 | |
|---|
| 46 | | - if (argp->mask & ~NFS_ACL_MASK) |
|---|
| 47 | | - RETURN_STATUS(nfserr_inval); |
|---|
| 43 | + if (argp->mask & ~NFS_ACL_MASK) { |
|---|
| 44 | + resp->status = nfserr_inval; |
|---|
| 45 | + goto out; |
|---|
| 46 | + } |
|---|
| 48 | 47 | resp->mask = argp->mask; |
|---|
| 49 | 48 | |
|---|
| 50 | 49 | if (resp->mask & (NFS_ACL|NFS_ACLCNT)) { |
|---|
| .. | .. |
|---|
| 54 | 53 | acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL); |
|---|
| 55 | 54 | } |
|---|
| 56 | 55 | if (IS_ERR(acl)) { |
|---|
| 57 | | - nfserr = nfserrno(PTR_ERR(acl)); |
|---|
| 56 | + resp->status = nfserrno(PTR_ERR(acl)); |
|---|
| 58 | 57 | goto fail; |
|---|
| 59 | 58 | } |
|---|
| 60 | 59 | resp->acl_access = acl; |
|---|
| .. | .. |
|---|
| 64 | 63 | of a non-directory! */ |
|---|
| 65 | 64 | acl = get_acl(inode, ACL_TYPE_DEFAULT); |
|---|
| 66 | 65 | if (IS_ERR(acl)) { |
|---|
| 67 | | - nfserr = nfserrno(PTR_ERR(acl)); |
|---|
| 66 | + resp->status = nfserrno(PTR_ERR(acl)); |
|---|
| 68 | 67 | goto fail; |
|---|
| 69 | 68 | } |
|---|
| 70 | 69 | resp->acl_default = acl; |
|---|
| 71 | 70 | } |
|---|
| 72 | 71 | |
|---|
| 73 | 72 | /* resp->acl_{access,default} are released in nfs3svc_release_getacl. */ |
|---|
| 74 | | - RETURN_STATUS(0); |
|---|
| 73 | +out: |
|---|
| 74 | + return rpc_success; |
|---|
| 75 | 75 | |
|---|
| 76 | 76 | fail: |
|---|
| 77 | 77 | posix_acl_release(resp->acl_access); |
|---|
| 78 | 78 | posix_acl_release(resp->acl_default); |
|---|
| 79 | | - RETURN_STATUS(nfserr); |
|---|
| 79 | + goto out; |
|---|
| 80 | 80 | } |
|---|
| 81 | 81 | |
|---|
| 82 | 82 | /* |
|---|
| .. | .. |
|---|
| 88 | 88 | struct nfsd3_attrstat *resp = rqstp->rq_resp; |
|---|
| 89 | 89 | struct inode *inode; |
|---|
| 90 | 90 | svc_fh *fh; |
|---|
| 91 | | - __be32 nfserr = 0; |
|---|
| 92 | 91 | int error; |
|---|
| 93 | 92 | |
|---|
| 94 | 93 | fh = fh_copy(&resp->fh, &argp->fh); |
|---|
| 95 | | - nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR); |
|---|
| 96 | | - if (nfserr) |
|---|
| 94 | + resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR); |
|---|
| 95 | + if (resp->status != nfs_ok) |
|---|
| 97 | 96 | goto out; |
|---|
| 98 | 97 | |
|---|
| 99 | 98 | inode = d_inode(fh->fh_dentry); |
|---|
| .. | .. |
|---|
| 113 | 112 | fh_unlock(fh); |
|---|
| 114 | 113 | fh_drop_write(fh); |
|---|
| 115 | 114 | out_errno: |
|---|
| 116 | | - nfserr = nfserrno(error); |
|---|
| 115 | + resp->status = nfserrno(error); |
|---|
| 117 | 116 | out: |
|---|
| 118 | 117 | /* argp->acl_{access,default} may have been allocated in |
|---|
| 119 | 118 | nfs3svc_decode_setaclargs. */ |
|---|
| 120 | 119 | posix_acl_release(argp->acl_access); |
|---|
| 121 | 120 | posix_acl_release(argp->acl_default); |
|---|
| 122 | | - RETURN_STATUS(nfserr); |
|---|
| 121 | + return rpc_success; |
|---|
| 123 | 122 | } |
|---|
| 124 | 123 | |
|---|
| 125 | 124 | /* |
|---|
| .. | .. |
|---|
| 174 | 173 | struct nfsd3_getaclres *resp = rqstp->rq_resp; |
|---|
| 175 | 174 | struct dentry *dentry = resp->fh.fh_dentry; |
|---|
| 176 | 175 | |
|---|
| 176 | + *p++ = resp->status; |
|---|
| 177 | 177 | p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); |
|---|
| 178 | 178 | if (resp->status == 0 && dentry && d_really_is_positive(dentry)) { |
|---|
| 179 | 179 | struct inode *inode = d_inode(dentry); |
|---|
| .. | .. |
|---|
| 218 | 218 | { |
|---|
| 219 | 219 | struct nfsd3_attrstat *resp = rqstp->rq_resp; |
|---|
| 220 | 220 | |
|---|
| 221 | + *p++ = resp->status; |
|---|
| 221 | 222 | p = nfs3svc_encode_post_op_attr(rqstp, p, &resp->fh); |
|---|
| 222 | | - |
|---|
| 223 | 223 | return xdr_ressize_check(rqstp, p); |
|---|
| 224 | 224 | } |
|---|
| 225 | 225 | |
|---|
| .. | .. |
|---|
| 235 | 235 | posix_acl_release(resp->acl_default); |
|---|
| 236 | 236 | } |
|---|
| 237 | 237 | |
|---|
| 238 | | -#define nfs3svc_decode_voidargs NULL |
|---|
| 239 | | -#define nfs3svc_release_void NULL |
|---|
| 240 | | -#define nfsd3_setaclres nfsd3_attrstat |
|---|
| 241 | | -#define nfsd3_voidres nfsd3_voidargs |
|---|
| 242 | 238 | struct nfsd3_voidargs { int dummy; }; |
|---|
| 243 | | - |
|---|
| 244 | | -#define PROC(name, argt, rest, relt, cache, respsize) \ |
|---|
| 245 | | -{ \ |
|---|
| 246 | | - .pc_func = nfsd3_proc_##name, \ |
|---|
| 247 | | - .pc_decode = nfs3svc_decode_##argt##args, \ |
|---|
| 248 | | - .pc_encode = nfs3svc_encode_##rest##res, \ |
|---|
| 249 | | - .pc_release = nfs3svc_release_##relt, \ |
|---|
| 250 | | - .pc_argsize = sizeof(struct nfsd3_##argt##args), \ |
|---|
| 251 | | - .pc_ressize = sizeof(struct nfsd3_##rest##res), \ |
|---|
| 252 | | - .pc_cachetype = cache, \ |
|---|
| 253 | | - .pc_xdrressize = respsize, \ |
|---|
| 254 | | -} |
|---|
| 255 | 239 | |
|---|
| 256 | 240 | #define ST 1 /* status*/ |
|---|
| 257 | 241 | #define AT 21 /* attributes */ |
|---|
| 258 | 242 | #define pAT (1+AT) /* post attributes - conditional */ |
|---|
| 259 | 243 | #define ACL (1+NFS_ACL_MAX_ENTRIES*3) /* Access Control List */ |
|---|
| 260 | 244 | |
|---|
| 261 | | -static const struct svc_procedure nfsd_acl_procedures3[] = { |
|---|
| 262 | | - PROC(null, void, void, void, RC_NOCACHE, ST), |
|---|
| 263 | | - PROC(getacl, getacl, getacl, getacl, RC_NOCACHE, ST+1+2*(1+ACL)), |
|---|
| 264 | | - PROC(setacl, setacl, setacl, fhandle, RC_NOCACHE, ST+pAT), |
|---|
| 245 | +static const struct svc_procedure nfsd_acl_procedures3[3] = { |
|---|
| 246 | + [ACLPROC3_NULL] = { |
|---|
| 247 | + .pc_func = nfsd3_proc_null, |
|---|
| 248 | + .pc_decode = nfs3svc_decode_voidarg, |
|---|
| 249 | + .pc_encode = nfs3svc_encode_voidres, |
|---|
| 250 | + .pc_argsize = sizeof(struct nfsd3_voidargs), |
|---|
| 251 | + .pc_ressize = sizeof(struct nfsd3_voidargs), |
|---|
| 252 | + .pc_cachetype = RC_NOCACHE, |
|---|
| 253 | + .pc_xdrressize = ST, |
|---|
| 254 | + }, |
|---|
| 255 | + [ACLPROC3_GETACL] = { |
|---|
| 256 | + .pc_func = nfsd3_proc_getacl, |
|---|
| 257 | + .pc_decode = nfs3svc_decode_getaclargs, |
|---|
| 258 | + .pc_encode = nfs3svc_encode_getaclres, |
|---|
| 259 | + .pc_release = nfs3svc_release_getacl, |
|---|
| 260 | + .pc_argsize = sizeof(struct nfsd3_getaclargs), |
|---|
| 261 | + .pc_ressize = sizeof(struct nfsd3_getaclres), |
|---|
| 262 | + .pc_cachetype = RC_NOCACHE, |
|---|
| 263 | + .pc_xdrressize = ST+1+2*(1+ACL), |
|---|
| 264 | + }, |
|---|
| 265 | + [ACLPROC3_SETACL] = { |
|---|
| 266 | + .pc_func = nfsd3_proc_setacl, |
|---|
| 267 | + .pc_decode = nfs3svc_decode_setaclargs, |
|---|
| 268 | + .pc_encode = nfs3svc_encode_setaclres, |
|---|
| 269 | + .pc_release = nfs3svc_release_fhandle, |
|---|
| 270 | + .pc_argsize = sizeof(struct nfsd3_setaclargs), |
|---|
| 271 | + .pc_ressize = sizeof(struct nfsd3_attrstat), |
|---|
| 272 | + .pc_cachetype = RC_NOCACHE, |
|---|
| 273 | + .pc_xdrressize = ST+pAT, |
|---|
| 274 | + }, |
|---|
| 265 | 275 | }; |
|---|
| 266 | 276 | |
|---|
| 267 | 277 | static unsigned int nfsd_acl_count3[ARRAY_SIZE(nfsd_acl_procedures3)]; |
|---|