| .. | .. |
|---|
| 15 | 15 | |
|---|
| 16 | 16 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
|---|
| 17 | 17 | |
|---|
| 18 | | -#define RETURN_STATUS(st) { resp->status = (st); return (st); } |
|---|
| 19 | | - |
|---|
| 20 | 18 | static int nfs3_ftypes[] = { |
|---|
| 21 | 19 | 0, /* NF3NON */ |
|---|
| 22 | 20 | S_IFREG, /* NF3REG */ |
|---|
| .. | .. |
|---|
| 34 | 32 | static __be32 |
|---|
| 35 | 33 | nfsd3_proc_null(struct svc_rqst *rqstp) |
|---|
| 36 | 34 | { |
|---|
| 37 | | - return nfs_ok; |
|---|
| 35 | + return rpc_success; |
|---|
| 38 | 36 | } |
|---|
| 39 | 37 | |
|---|
| 40 | 38 | /* |
|---|
| .. | .. |
|---|
| 45 | 43 | { |
|---|
| 46 | 44 | struct nfsd_fhandle *argp = rqstp->rq_argp; |
|---|
| 47 | 45 | struct nfsd3_attrstat *resp = rqstp->rq_resp; |
|---|
| 48 | | - __be32 nfserr; |
|---|
| 49 | 46 | |
|---|
| 50 | 47 | dprintk("nfsd: GETATTR(3) %s\n", |
|---|
| 51 | 48 | SVCFH_fmt(&argp->fh)); |
|---|
| 52 | 49 | |
|---|
| 53 | 50 | fh_copy(&resp->fh, &argp->fh); |
|---|
| 54 | | - nfserr = fh_verify(rqstp, &resp->fh, 0, |
|---|
| 55 | | - NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT); |
|---|
| 56 | | - if (nfserr) |
|---|
| 57 | | - RETURN_STATUS(nfserr); |
|---|
| 51 | + resp->status = fh_verify(rqstp, &resp->fh, 0, |
|---|
| 52 | + NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT); |
|---|
| 53 | + if (resp->status != nfs_ok) |
|---|
| 54 | + goto out; |
|---|
| 58 | 55 | |
|---|
| 59 | | - nfserr = fh_getattr(&resp->fh, &resp->stat); |
|---|
| 60 | | - |
|---|
| 61 | | - RETURN_STATUS(nfserr); |
|---|
| 56 | + resp->status = fh_getattr(&resp->fh, &resp->stat); |
|---|
| 57 | +out: |
|---|
| 58 | + return rpc_success; |
|---|
| 62 | 59 | } |
|---|
| 63 | 60 | |
|---|
| 64 | 61 | /* |
|---|
| .. | .. |
|---|
| 69 | 66 | { |
|---|
| 70 | 67 | struct nfsd3_sattrargs *argp = rqstp->rq_argp; |
|---|
| 71 | 68 | struct nfsd3_attrstat *resp = rqstp->rq_resp; |
|---|
| 72 | | - __be32 nfserr; |
|---|
| 73 | 69 | |
|---|
| 74 | 70 | dprintk("nfsd: SETATTR(3) %s\n", |
|---|
| 75 | 71 | SVCFH_fmt(&argp->fh)); |
|---|
| 76 | 72 | |
|---|
| 77 | 73 | fh_copy(&resp->fh, &argp->fh); |
|---|
| 78 | | - nfserr = nfsd_setattr(rqstp, &resp->fh, &argp->attrs, |
|---|
| 79 | | - argp->check_guard, argp->guardtime); |
|---|
| 80 | | - RETURN_STATUS(nfserr); |
|---|
| 74 | + resp->status = nfsd_setattr(rqstp, &resp->fh, &argp->attrs, |
|---|
| 75 | + argp->check_guard, argp->guardtime); |
|---|
| 76 | + return rpc_success; |
|---|
| 81 | 77 | } |
|---|
| 82 | 78 | |
|---|
| 83 | 79 | /* |
|---|
| .. | .. |
|---|
| 88 | 84 | { |
|---|
| 89 | 85 | struct nfsd3_diropargs *argp = rqstp->rq_argp; |
|---|
| 90 | 86 | struct nfsd3_diropres *resp = rqstp->rq_resp; |
|---|
| 91 | | - __be32 nfserr; |
|---|
| 92 | 87 | |
|---|
| 93 | 88 | dprintk("nfsd: LOOKUP(3) %s %.*s\n", |
|---|
| 94 | 89 | SVCFH_fmt(&argp->fh), |
|---|
| .. | .. |
|---|
| 98 | 93 | fh_copy(&resp->dirfh, &argp->fh); |
|---|
| 99 | 94 | fh_init(&resp->fh, NFS3_FHSIZE); |
|---|
| 100 | 95 | |
|---|
| 101 | | - nfserr = nfsd_lookup(rqstp, &resp->dirfh, |
|---|
| 102 | | - argp->name, |
|---|
| 103 | | - argp->len, |
|---|
| 104 | | - &resp->fh); |
|---|
| 105 | | - RETURN_STATUS(nfserr); |
|---|
| 96 | + resp->status = nfsd_lookup(rqstp, &resp->dirfh, |
|---|
| 97 | + argp->name, argp->len, |
|---|
| 98 | + &resp->fh); |
|---|
| 99 | + return rpc_success; |
|---|
| 106 | 100 | } |
|---|
| 107 | 101 | |
|---|
| 108 | 102 | /* |
|---|
| .. | .. |
|---|
| 113 | 107 | { |
|---|
| 114 | 108 | struct nfsd3_accessargs *argp = rqstp->rq_argp; |
|---|
| 115 | 109 | struct nfsd3_accessres *resp = rqstp->rq_resp; |
|---|
| 116 | | - __be32 nfserr; |
|---|
| 117 | 110 | |
|---|
| 118 | 111 | dprintk("nfsd: ACCESS(3) %s 0x%x\n", |
|---|
| 119 | 112 | SVCFH_fmt(&argp->fh), |
|---|
| .. | .. |
|---|
| 121 | 114 | |
|---|
| 122 | 115 | fh_copy(&resp->fh, &argp->fh); |
|---|
| 123 | 116 | resp->access = argp->access; |
|---|
| 124 | | - nfserr = nfsd_access(rqstp, &resp->fh, &resp->access, NULL); |
|---|
| 125 | | - RETURN_STATUS(nfserr); |
|---|
| 117 | + resp->status = nfsd_access(rqstp, &resp->fh, &resp->access, NULL); |
|---|
| 118 | + return rpc_success; |
|---|
| 126 | 119 | } |
|---|
| 127 | 120 | |
|---|
| 128 | 121 | /* |
|---|
| .. | .. |
|---|
| 133 | 126 | { |
|---|
| 134 | 127 | struct nfsd3_readlinkargs *argp = rqstp->rq_argp; |
|---|
| 135 | 128 | struct nfsd3_readlinkres *resp = rqstp->rq_resp; |
|---|
| 136 | | - __be32 nfserr; |
|---|
| 137 | 129 | |
|---|
| 138 | 130 | dprintk("nfsd: READLINK(3) %s\n", SVCFH_fmt(&argp->fh)); |
|---|
| 139 | 131 | |
|---|
| 140 | 132 | /* Read the symlink. */ |
|---|
| 141 | 133 | fh_copy(&resp->fh, &argp->fh); |
|---|
| 142 | 134 | resp->len = NFS3_MAXPATHLEN; |
|---|
| 143 | | - nfserr = nfsd_readlink(rqstp, &resp->fh, argp->buffer, &resp->len); |
|---|
| 144 | | - RETURN_STATUS(nfserr); |
|---|
| 135 | + resp->status = nfsd_readlink(rqstp, &resp->fh, argp->buffer, &resp->len); |
|---|
| 136 | + return rpc_success; |
|---|
| 145 | 137 | } |
|---|
| 146 | 138 | |
|---|
| 147 | 139 | /* |
|---|
| .. | .. |
|---|
| 152 | 144 | { |
|---|
| 153 | 145 | struct nfsd3_readargs *argp = rqstp->rq_argp; |
|---|
| 154 | 146 | struct nfsd3_readres *resp = rqstp->rq_resp; |
|---|
| 155 | | - __be32 nfserr; |
|---|
| 156 | 147 | u32 max_blocksize = svc_max_payload(rqstp); |
|---|
| 157 | 148 | unsigned long cnt = min(argp->count, max_blocksize); |
|---|
| 158 | 149 | |
|---|
| .. | .. |
|---|
| 169 | 160 | svc_reserve_auth(rqstp, ((1 + NFS3_POST_OP_ATTR_WORDS + 3)<<2) + resp->count +4); |
|---|
| 170 | 161 | |
|---|
| 171 | 162 | fh_copy(&resp->fh, &argp->fh); |
|---|
| 172 | | - nfserr = nfsd_read(rqstp, &resp->fh, |
|---|
| 173 | | - argp->offset, |
|---|
| 174 | | - rqstp->rq_vec, argp->vlen, |
|---|
| 175 | | - &resp->count); |
|---|
| 176 | | - if (nfserr == 0) { |
|---|
| 177 | | - struct inode *inode = d_inode(resp->fh.fh_dentry); |
|---|
| 178 | | - resp->eof = nfsd_eof_on_read(cnt, resp->count, argp->offset, |
|---|
| 179 | | - inode->i_size); |
|---|
| 180 | | - } |
|---|
| 181 | | - |
|---|
| 182 | | - RETURN_STATUS(nfserr); |
|---|
| 163 | + resp->status = nfsd_read(rqstp, &resp->fh, argp->offset, |
|---|
| 164 | + rqstp->rq_vec, argp->vlen, &resp->count, |
|---|
| 165 | + &resp->eof); |
|---|
| 166 | + return rpc_success; |
|---|
| 183 | 167 | } |
|---|
| 184 | 168 | |
|---|
| 185 | 169 | /* |
|---|
| .. | .. |
|---|
| 190 | 174 | { |
|---|
| 191 | 175 | struct nfsd3_writeargs *argp = rqstp->rq_argp; |
|---|
| 192 | 176 | struct nfsd3_writeres *resp = rqstp->rq_resp; |
|---|
| 193 | | - __be32 nfserr; |
|---|
| 194 | 177 | unsigned long cnt = argp->len; |
|---|
| 195 | 178 | unsigned int nvecs; |
|---|
| 196 | 179 | |
|---|
| .. | .. |
|---|
| 209 | 192 | resp->committed = argp->stable; |
|---|
| 210 | 193 | nvecs = svc_fill_write_vector(rqstp, rqstp->rq_arg.pages, |
|---|
| 211 | 194 | &argp->first, cnt); |
|---|
| 212 | | - if (!nvecs) |
|---|
| 213 | | - RETURN_STATUS(nfserr_io); |
|---|
| 214 | | - nfserr = nfsd_write(rqstp, &resp->fh, argp->offset, |
|---|
| 215 | | - rqstp->rq_vec, nvecs, &cnt, |
|---|
| 216 | | - resp->committed); |
|---|
| 195 | + if (!nvecs) { |
|---|
| 196 | + resp->status = nfserr_io; |
|---|
| 197 | + goto out; |
|---|
| 198 | + } |
|---|
| 199 | + resp->status = nfsd_write(rqstp, &resp->fh, argp->offset, |
|---|
| 200 | + rqstp->rq_vec, nvecs, &cnt, |
|---|
| 201 | + resp->committed, resp->verf); |
|---|
| 217 | 202 | resp->count = cnt; |
|---|
| 218 | | - RETURN_STATUS(nfserr); |
|---|
| 203 | +out: |
|---|
| 204 | + return rpc_success; |
|---|
| 219 | 205 | } |
|---|
| 220 | 206 | |
|---|
| 221 | 207 | /* |
|---|
| .. | .. |
|---|
| 230 | 216 | struct nfsd3_diropres *resp = rqstp->rq_resp; |
|---|
| 231 | 217 | svc_fh *dirfhp, *newfhp = NULL; |
|---|
| 232 | 218 | struct iattr *attr; |
|---|
| 233 | | - __be32 nfserr; |
|---|
| 234 | 219 | |
|---|
| 235 | 220 | dprintk("nfsd: CREATE(3) %s %.*s\n", |
|---|
| 236 | 221 | SVCFH_fmt(&argp->fh), |
|---|
| .. | .. |
|---|
| 251 | 236 | } |
|---|
| 252 | 237 | |
|---|
| 253 | 238 | /* Now create the file and set attributes */ |
|---|
| 254 | | - nfserr = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len, |
|---|
| 255 | | - attr, newfhp, |
|---|
| 256 | | - argp->createmode, (u32 *)argp->verf, NULL, NULL); |
|---|
| 257 | | - |
|---|
| 258 | | - RETURN_STATUS(nfserr); |
|---|
| 239 | + resp->status = do_nfsd_create(rqstp, dirfhp, argp->name, argp->len, |
|---|
| 240 | + attr, newfhp, argp->createmode, |
|---|
| 241 | + (u32 *)argp->verf, NULL, NULL); |
|---|
| 242 | + return rpc_success; |
|---|
| 259 | 243 | } |
|---|
| 260 | 244 | |
|---|
| 261 | 245 | /* |
|---|
| .. | .. |
|---|
| 266 | 250 | { |
|---|
| 267 | 251 | struct nfsd3_createargs *argp = rqstp->rq_argp; |
|---|
| 268 | 252 | struct nfsd3_diropres *resp = rqstp->rq_resp; |
|---|
| 269 | | - __be32 nfserr; |
|---|
| 270 | 253 | |
|---|
| 271 | 254 | dprintk("nfsd: MKDIR(3) %s %.*s\n", |
|---|
| 272 | 255 | SVCFH_fmt(&argp->fh), |
|---|
| .. | .. |
|---|
| 276 | 259 | argp->attrs.ia_valid &= ~ATTR_SIZE; |
|---|
| 277 | 260 | fh_copy(&resp->dirfh, &argp->fh); |
|---|
| 278 | 261 | fh_init(&resp->fh, NFS3_FHSIZE); |
|---|
| 279 | | - nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, |
|---|
| 280 | | - &argp->attrs, S_IFDIR, 0, &resp->fh); |
|---|
| 262 | + resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, |
|---|
| 263 | + &argp->attrs, S_IFDIR, 0, &resp->fh); |
|---|
| 281 | 264 | fh_unlock(&resp->dirfh); |
|---|
| 282 | | - RETURN_STATUS(nfserr); |
|---|
| 265 | + return rpc_success; |
|---|
| 283 | 266 | } |
|---|
| 284 | 267 | |
|---|
| 285 | 268 | static __be32 |
|---|
| .. | .. |
|---|
| 287 | 270 | { |
|---|
| 288 | 271 | struct nfsd3_symlinkargs *argp = rqstp->rq_argp; |
|---|
| 289 | 272 | struct nfsd3_diropres *resp = rqstp->rq_resp; |
|---|
| 290 | | - __be32 nfserr; |
|---|
| 291 | 273 | |
|---|
| 292 | | - if (argp->tlen == 0) |
|---|
| 293 | | - RETURN_STATUS(nfserr_inval); |
|---|
| 294 | | - if (argp->tlen > NFS3_MAXPATHLEN) |
|---|
| 295 | | - RETURN_STATUS(nfserr_nametoolong); |
|---|
| 274 | + if (argp->tlen == 0) { |
|---|
| 275 | + resp->status = nfserr_inval; |
|---|
| 276 | + goto out; |
|---|
| 277 | + } |
|---|
| 278 | + if (argp->tlen > NFS3_MAXPATHLEN) { |
|---|
| 279 | + resp->status = nfserr_nametoolong; |
|---|
| 280 | + goto out; |
|---|
| 281 | + } |
|---|
| 296 | 282 | |
|---|
| 297 | 283 | argp->tname = svc_fill_symlink_pathname(rqstp, &argp->first, |
|---|
| 298 | 284 | page_address(rqstp->rq_arg.pages[0]), |
|---|
| 299 | 285 | argp->tlen); |
|---|
| 300 | | - if (IS_ERR(argp->tname)) |
|---|
| 301 | | - RETURN_STATUS(nfserrno(PTR_ERR(argp->tname))); |
|---|
| 286 | + if (IS_ERR(argp->tname)) { |
|---|
| 287 | + resp->status = nfserrno(PTR_ERR(argp->tname)); |
|---|
| 288 | + goto out; |
|---|
| 289 | + } |
|---|
| 302 | 290 | |
|---|
| 303 | 291 | dprintk("nfsd: SYMLINK(3) %s %.*s -> %.*s\n", |
|---|
| 304 | 292 | SVCFH_fmt(&argp->ffh), |
|---|
| .. | .. |
|---|
| 307 | 295 | |
|---|
| 308 | 296 | fh_copy(&resp->dirfh, &argp->ffh); |
|---|
| 309 | 297 | fh_init(&resp->fh, NFS3_FHSIZE); |
|---|
| 310 | | - nfserr = nfsd_symlink(rqstp, &resp->dirfh, argp->fname, argp->flen, |
|---|
| 311 | | - argp->tname, &resp->fh); |
|---|
| 298 | + resp->status = nfsd_symlink(rqstp, &resp->dirfh, argp->fname, |
|---|
| 299 | + argp->flen, argp->tname, &resp->fh); |
|---|
| 312 | 300 | kfree(argp->tname); |
|---|
| 313 | | - RETURN_STATUS(nfserr); |
|---|
| 301 | +out: |
|---|
| 302 | + return rpc_success; |
|---|
| 314 | 303 | } |
|---|
| 315 | 304 | |
|---|
| 316 | 305 | /* |
|---|
| .. | .. |
|---|
| 321 | 310 | { |
|---|
| 322 | 311 | struct nfsd3_mknodargs *argp = rqstp->rq_argp; |
|---|
| 323 | 312 | struct nfsd3_diropres *resp = rqstp->rq_resp; |
|---|
| 324 | | - __be32 nfserr; |
|---|
| 325 | 313 | int type; |
|---|
| 326 | 314 | dev_t rdev = 0; |
|---|
| 327 | 315 | |
|---|
| .. | .. |
|---|
| 333 | 321 | fh_copy(&resp->dirfh, &argp->fh); |
|---|
| 334 | 322 | fh_init(&resp->fh, NFS3_FHSIZE); |
|---|
| 335 | 323 | |
|---|
| 336 | | - if (argp->ftype == 0 || argp->ftype >= NF3BAD) |
|---|
| 337 | | - RETURN_STATUS(nfserr_inval); |
|---|
| 338 | 324 | if (argp->ftype == NF3CHR || argp->ftype == NF3BLK) { |
|---|
| 339 | 325 | rdev = MKDEV(argp->major, argp->minor); |
|---|
| 340 | 326 | if (MAJOR(rdev) != argp->major || |
|---|
| 341 | | - MINOR(rdev) != argp->minor) |
|---|
| 342 | | - RETURN_STATUS(nfserr_inval); |
|---|
| 343 | | - } else |
|---|
| 344 | | - if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) |
|---|
| 345 | | - RETURN_STATUS(nfserr_inval); |
|---|
| 327 | + MINOR(rdev) != argp->minor) { |
|---|
| 328 | + resp->status = nfserr_inval; |
|---|
| 329 | + goto out; |
|---|
| 330 | + } |
|---|
| 331 | + } else if (argp->ftype != NF3SOCK && argp->ftype != NF3FIFO) { |
|---|
| 332 | + resp->status = nfserr_badtype; |
|---|
| 333 | + goto out; |
|---|
| 334 | + } |
|---|
| 346 | 335 | |
|---|
| 347 | 336 | type = nfs3_ftypes[argp->ftype]; |
|---|
| 348 | | - nfserr = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, |
|---|
| 349 | | - &argp->attrs, type, rdev, &resp->fh); |
|---|
| 337 | + resp->status = nfsd_create(rqstp, &resp->dirfh, argp->name, argp->len, |
|---|
| 338 | + &argp->attrs, type, rdev, &resp->fh); |
|---|
| 350 | 339 | fh_unlock(&resp->dirfh); |
|---|
| 351 | | - RETURN_STATUS(nfserr); |
|---|
| 340 | +out: |
|---|
| 341 | + return rpc_success; |
|---|
| 352 | 342 | } |
|---|
| 353 | 343 | |
|---|
| 354 | 344 | /* |
|---|
| .. | .. |
|---|
| 359 | 349 | { |
|---|
| 360 | 350 | struct nfsd3_diropargs *argp = rqstp->rq_argp; |
|---|
| 361 | 351 | struct nfsd3_attrstat *resp = rqstp->rq_resp; |
|---|
| 362 | | - __be32 nfserr; |
|---|
| 363 | 352 | |
|---|
| 364 | 353 | dprintk("nfsd: REMOVE(3) %s %.*s\n", |
|---|
| 365 | 354 | SVCFH_fmt(&argp->fh), |
|---|
| .. | .. |
|---|
| 368 | 357 | |
|---|
| 369 | 358 | /* Unlink. -S_IFDIR means file must not be a directory */ |
|---|
| 370 | 359 | fh_copy(&resp->fh, &argp->fh); |
|---|
| 371 | | - nfserr = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR, argp->name, argp->len); |
|---|
| 360 | + resp->status = nfsd_unlink(rqstp, &resp->fh, -S_IFDIR, |
|---|
| 361 | + argp->name, argp->len); |
|---|
| 372 | 362 | fh_unlock(&resp->fh); |
|---|
| 373 | | - RETURN_STATUS(nfserr); |
|---|
| 363 | + return rpc_success; |
|---|
| 374 | 364 | } |
|---|
| 375 | 365 | |
|---|
| 376 | 366 | /* |
|---|
| .. | .. |
|---|
| 381 | 371 | { |
|---|
| 382 | 372 | struct nfsd3_diropargs *argp = rqstp->rq_argp; |
|---|
| 383 | 373 | struct nfsd3_attrstat *resp = rqstp->rq_resp; |
|---|
| 384 | | - __be32 nfserr; |
|---|
| 385 | 374 | |
|---|
| 386 | 375 | dprintk("nfsd: RMDIR(3) %s %.*s\n", |
|---|
| 387 | 376 | SVCFH_fmt(&argp->fh), |
|---|
| .. | .. |
|---|
| 389 | 378 | argp->name); |
|---|
| 390 | 379 | |
|---|
| 391 | 380 | fh_copy(&resp->fh, &argp->fh); |
|---|
| 392 | | - nfserr = nfsd_unlink(rqstp, &resp->fh, S_IFDIR, argp->name, argp->len); |
|---|
| 381 | + resp->status = nfsd_unlink(rqstp, &resp->fh, S_IFDIR, |
|---|
| 382 | + argp->name, argp->len); |
|---|
| 393 | 383 | fh_unlock(&resp->fh); |
|---|
| 394 | | - RETURN_STATUS(nfserr); |
|---|
| 384 | + return rpc_success; |
|---|
| 395 | 385 | } |
|---|
| 396 | 386 | |
|---|
| 397 | 387 | static __be32 |
|---|
| .. | .. |
|---|
| 399 | 389 | { |
|---|
| 400 | 390 | struct nfsd3_renameargs *argp = rqstp->rq_argp; |
|---|
| 401 | 391 | struct nfsd3_renameres *resp = rqstp->rq_resp; |
|---|
| 402 | | - __be32 nfserr; |
|---|
| 403 | 392 | |
|---|
| 404 | 393 | dprintk("nfsd: RENAME(3) %s %.*s ->\n", |
|---|
| 405 | 394 | SVCFH_fmt(&argp->ffh), |
|---|
| .. | .. |
|---|
| 412 | 401 | |
|---|
| 413 | 402 | fh_copy(&resp->ffh, &argp->ffh); |
|---|
| 414 | 403 | fh_copy(&resp->tfh, &argp->tfh); |
|---|
| 415 | | - nfserr = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen, |
|---|
| 416 | | - &resp->tfh, argp->tname, argp->tlen); |
|---|
| 417 | | - RETURN_STATUS(nfserr); |
|---|
| 404 | + resp->status = nfsd_rename(rqstp, &resp->ffh, argp->fname, argp->flen, |
|---|
| 405 | + &resp->tfh, argp->tname, argp->tlen); |
|---|
| 406 | + return rpc_success; |
|---|
| 418 | 407 | } |
|---|
| 419 | 408 | |
|---|
| 420 | 409 | static __be32 |
|---|
| .. | .. |
|---|
| 422 | 411 | { |
|---|
| 423 | 412 | struct nfsd3_linkargs *argp = rqstp->rq_argp; |
|---|
| 424 | 413 | struct nfsd3_linkres *resp = rqstp->rq_resp; |
|---|
| 425 | | - __be32 nfserr; |
|---|
| 426 | 414 | |
|---|
| 427 | 415 | dprintk("nfsd: LINK(3) %s ->\n", |
|---|
| 428 | 416 | SVCFH_fmt(&argp->ffh)); |
|---|
| .. | .. |
|---|
| 433 | 421 | |
|---|
| 434 | 422 | fh_copy(&resp->fh, &argp->ffh); |
|---|
| 435 | 423 | fh_copy(&resp->tfh, &argp->tfh); |
|---|
| 436 | | - nfserr = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen, |
|---|
| 437 | | - &resp->fh); |
|---|
| 438 | | - RETURN_STATUS(nfserr); |
|---|
| 424 | + resp->status = nfsd_link(rqstp, &resp->tfh, argp->tname, argp->tlen, |
|---|
| 425 | + &resp->fh); |
|---|
| 426 | + return rpc_success; |
|---|
| 439 | 427 | } |
|---|
| 440 | 428 | |
|---|
| 441 | 429 | /* |
|---|
| .. | .. |
|---|
| 446 | 434 | { |
|---|
| 447 | 435 | struct nfsd3_readdirargs *argp = rqstp->rq_argp; |
|---|
| 448 | 436 | struct nfsd3_readdirres *resp = rqstp->rq_resp; |
|---|
| 449 | | - __be32 nfserr; |
|---|
| 450 | | - int count; |
|---|
| 437 | + int count = 0; |
|---|
| 438 | + struct page **p; |
|---|
| 439 | + caddr_t page_addr = NULL; |
|---|
| 451 | 440 | |
|---|
| 452 | 441 | dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", |
|---|
| 453 | 442 | SVCFH_fmt(&argp->fh), |
|---|
| .. | .. |
|---|
| 464 | 453 | resp->common.err = nfs_ok; |
|---|
| 465 | 454 | resp->buffer = argp->buffer; |
|---|
| 466 | 455 | resp->rqstp = rqstp; |
|---|
| 467 | | - nfserr = nfsd_readdir(rqstp, &resp->fh, (loff_t*) &argp->cookie, |
|---|
| 468 | | - &resp->common, nfs3svc_encode_entry); |
|---|
| 456 | + resp->status = nfsd_readdir(rqstp, &resp->fh, (loff_t *)&argp->cookie, |
|---|
| 457 | + &resp->common, nfs3svc_encode_entry); |
|---|
| 469 | 458 | memcpy(resp->verf, argp->verf, 8); |
|---|
| 470 | | - resp->count = resp->buffer - argp->buffer; |
|---|
| 459 | + count = 0; |
|---|
| 460 | + for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) { |
|---|
| 461 | + page_addr = page_address(*p); |
|---|
| 462 | + |
|---|
| 463 | + if (((caddr_t)resp->buffer >= page_addr) && |
|---|
| 464 | + ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) { |
|---|
| 465 | + count += (caddr_t)resp->buffer - page_addr; |
|---|
| 466 | + break; |
|---|
| 467 | + } |
|---|
| 468 | + count += PAGE_SIZE; |
|---|
| 469 | + } |
|---|
| 470 | + resp->count = count >> 2; |
|---|
| 471 | 471 | if (resp->offset) { |
|---|
| 472 | 472 | loff_t offset = argp->cookie; |
|---|
| 473 | 473 | |
|---|
| .. | .. |
|---|
| 482 | 482 | resp->offset = NULL; |
|---|
| 483 | 483 | } |
|---|
| 484 | 484 | |
|---|
| 485 | | - RETURN_STATUS(nfserr); |
|---|
| 485 | + return rpc_success; |
|---|
| 486 | 486 | } |
|---|
| 487 | 487 | |
|---|
| 488 | 488 | /* |
|---|
| .. | .. |
|---|
| 494 | 494 | { |
|---|
| 495 | 495 | struct nfsd3_readdirargs *argp = rqstp->rq_argp; |
|---|
| 496 | 496 | struct nfsd3_readdirres *resp = rqstp->rq_resp; |
|---|
| 497 | | - __be32 nfserr; |
|---|
| 498 | 497 | int count = 0; |
|---|
| 499 | 498 | loff_t offset; |
|---|
| 500 | 499 | struct page **p; |
|---|
| .. | .. |
|---|
| 517 | 516 | resp->rqstp = rqstp; |
|---|
| 518 | 517 | offset = argp->cookie; |
|---|
| 519 | 518 | |
|---|
| 520 | | - nfserr = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP); |
|---|
| 521 | | - if (nfserr) |
|---|
| 522 | | - RETURN_STATUS(nfserr); |
|---|
| 519 | + resp->status = fh_verify(rqstp, &resp->fh, S_IFDIR, NFSD_MAY_NOP); |
|---|
| 520 | + if (resp->status != nfs_ok) |
|---|
| 521 | + goto out; |
|---|
| 523 | 522 | |
|---|
| 524 | | - if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) |
|---|
| 525 | | - RETURN_STATUS(nfserr_notsupp); |
|---|
| 523 | + if (resp->fh.fh_export->ex_flags & NFSEXP_NOREADDIRPLUS) { |
|---|
| 524 | + resp->status = nfserr_notsupp; |
|---|
| 525 | + goto out; |
|---|
| 526 | + } |
|---|
| 526 | 527 | |
|---|
| 527 | | - nfserr = nfsd_readdir(rqstp, &resp->fh, |
|---|
| 528 | | - &offset, |
|---|
| 529 | | - &resp->common, |
|---|
| 530 | | - nfs3svc_encode_entry_plus); |
|---|
| 528 | + resp->status = nfsd_readdir(rqstp, &resp->fh, &offset, |
|---|
| 529 | + &resp->common, nfs3svc_encode_entry_plus); |
|---|
| 531 | 530 | memcpy(resp->verf, argp->verf, 8); |
|---|
| 532 | 531 | for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) { |
|---|
| 533 | 532 | page_addr = page_address(*p); |
|---|
| .. | .. |
|---|
| 552 | 551 | resp->offset = NULL; |
|---|
| 553 | 552 | } |
|---|
| 554 | 553 | |
|---|
| 555 | | - RETURN_STATUS(nfserr); |
|---|
| 554 | +out: |
|---|
| 555 | + return rpc_success; |
|---|
| 556 | 556 | } |
|---|
| 557 | 557 | |
|---|
| 558 | 558 | /* |
|---|
| .. | .. |
|---|
| 563 | 563 | { |
|---|
| 564 | 564 | struct nfsd_fhandle *argp = rqstp->rq_argp; |
|---|
| 565 | 565 | struct nfsd3_fsstatres *resp = rqstp->rq_resp; |
|---|
| 566 | | - __be32 nfserr; |
|---|
| 567 | 566 | |
|---|
| 568 | 567 | dprintk("nfsd: FSSTAT(3) %s\n", |
|---|
| 569 | 568 | SVCFH_fmt(&argp->fh)); |
|---|
| 570 | 569 | |
|---|
| 571 | | - nfserr = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0); |
|---|
| 570 | + resp->status = nfsd_statfs(rqstp, &argp->fh, &resp->stats, 0); |
|---|
| 572 | 571 | fh_put(&argp->fh); |
|---|
| 573 | | - RETURN_STATUS(nfserr); |
|---|
| 572 | + return rpc_success; |
|---|
| 574 | 573 | } |
|---|
| 575 | 574 | |
|---|
| 576 | 575 | /* |
|---|
| .. | .. |
|---|
| 581 | 580 | { |
|---|
| 582 | 581 | struct nfsd_fhandle *argp = rqstp->rq_argp; |
|---|
| 583 | 582 | struct nfsd3_fsinfores *resp = rqstp->rq_resp; |
|---|
| 584 | | - __be32 nfserr; |
|---|
| 585 | 583 | u32 max_blocksize = svc_max_payload(rqstp); |
|---|
| 586 | 584 | |
|---|
| 587 | 585 | dprintk("nfsd: FSINFO(3) %s\n", |
|---|
| .. | .. |
|---|
| 593 | 591 | resp->f_wtmax = max_blocksize; |
|---|
| 594 | 592 | resp->f_wtpref = max_blocksize; |
|---|
| 595 | 593 | resp->f_wtmult = PAGE_SIZE; |
|---|
| 596 | | - resp->f_dtpref = PAGE_SIZE; |
|---|
| 594 | + resp->f_dtpref = max_blocksize; |
|---|
| 597 | 595 | resp->f_maxfilesize = ~(u32) 0; |
|---|
| 598 | 596 | resp->f_properties = NFS3_FSF_DEFAULT; |
|---|
| 599 | 597 | |
|---|
| 600 | | - nfserr = fh_verify(rqstp, &argp->fh, 0, |
|---|
| 601 | | - NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT); |
|---|
| 598 | + resp->status = fh_verify(rqstp, &argp->fh, 0, |
|---|
| 599 | + NFSD_MAY_NOP | NFSD_MAY_BYPASS_GSS_ON_ROOT); |
|---|
| 602 | 600 | |
|---|
| 603 | 601 | /* Check special features of the file system. May request |
|---|
| 604 | 602 | * different read/write sizes for file systems known to have |
|---|
| 605 | 603 | * problems with large blocks */ |
|---|
| 606 | | - if (nfserr == 0) { |
|---|
| 604 | + if (resp->status == nfs_ok) { |
|---|
| 607 | 605 | struct super_block *sb = argp->fh.fh_dentry->d_sb; |
|---|
| 608 | 606 | |
|---|
| 609 | 607 | /* Note that we don't care for remote fs's here */ |
|---|
| .. | .. |
|---|
| 614 | 612 | } |
|---|
| 615 | 613 | |
|---|
| 616 | 614 | fh_put(&argp->fh); |
|---|
| 617 | | - RETURN_STATUS(nfserr); |
|---|
| 615 | + return rpc_success; |
|---|
| 618 | 616 | } |
|---|
| 619 | 617 | |
|---|
| 620 | 618 | /* |
|---|
| .. | .. |
|---|
| 625 | 623 | { |
|---|
| 626 | 624 | struct nfsd_fhandle *argp = rqstp->rq_argp; |
|---|
| 627 | 625 | struct nfsd3_pathconfres *resp = rqstp->rq_resp; |
|---|
| 628 | | - __be32 nfserr; |
|---|
| 629 | 626 | |
|---|
| 630 | 627 | dprintk("nfsd: PATHCONF(3) %s\n", |
|---|
| 631 | 628 | SVCFH_fmt(&argp->fh)); |
|---|
| .. | .. |
|---|
| 638 | 635 | resp->p_case_insensitive = 0; |
|---|
| 639 | 636 | resp->p_case_preserving = 1; |
|---|
| 640 | 637 | |
|---|
| 641 | | - nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); |
|---|
| 638 | + resp->status = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); |
|---|
| 642 | 639 | |
|---|
| 643 | | - if (nfserr == 0) { |
|---|
| 640 | + if (resp->status == nfs_ok) { |
|---|
| 644 | 641 | struct super_block *sb = argp->fh.fh_dentry->d_sb; |
|---|
| 645 | 642 | |
|---|
| 646 | 643 | /* Note that we don't care for remote fs's here */ |
|---|
| .. | .. |
|---|
| 657 | 654 | } |
|---|
| 658 | 655 | |
|---|
| 659 | 656 | fh_put(&argp->fh); |
|---|
| 660 | | - RETURN_STATUS(nfserr); |
|---|
| 657 | + return rpc_success; |
|---|
| 661 | 658 | } |
|---|
| 662 | | - |
|---|
| 663 | 659 | |
|---|
| 664 | 660 | /* |
|---|
| 665 | 661 | * Commit a file (range) to stable storage. |
|---|
| .. | .. |
|---|
| 669 | 665 | { |
|---|
| 670 | 666 | struct nfsd3_commitargs *argp = rqstp->rq_argp; |
|---|
| 671 | 667 | struct nfsd3_commitres *resp = rqstp->rq_resp; |
|---|
| 672 | | - __be32 nfserr; |
|---|
| 673 | 668 | |
|---|
| 674 | 669 | dprintk("nfsd: COMMIT(3) %s %u@%Lu\n", |
|---|
| 675 | 670 | SVCFH_fmt(&argp->fh), |
|---|
| 676 | 671 | argp->count, |
|---|
| 677 | 672 | (unsigned long long) argp->offset); |
|---|
| 678 | 673 | |
|---|
| 679 | | - if (argp->offset > NFS_OFFSET_MAX) |
|---|
| 680 | | - RETURN_STATUS(nfserr_inval); |
|---|
| 674 | + if (argp->offset > NFS_OFFSET_MAX) { |
|---|
| 675 | + resp->status = nfserr_inval; |
|---|
| 676 | + goto out; |
|---|
| 677 | + } |
|---|
| 681 | 678 | |
|---|
| 682 | 679 | fh_copy(&resp->fh, &argp->fh); |
|---|
| 683 | | - nfserr = nfsd_commit(rqstp, &resp->fh, argp->offset, argp->count); |
|---|
| 684 | | - |
|---|
| 685 | | - RETURN_STATUS(nfserr); |
|---|
| 680 | + resp->status = nfsd_commit(rqstp, &resp->fh, argp->offset, |
|---|
| 681 | + argp->count, resp->verf); |
|---|
| 682 | +out: |
|---|
| 683 | + return rpc_success; |
|---|
| 686 | 684 | } |
|---|
| 687 | 685 | |
|---|
| 688 | 686 | |
|---|
| .. | .. |
|---|
| 712 | 710 | static const struct svc_procedure nfsd_procedures3[22] = { |
|---|
| 713 | 711 | [NFS3PROC_NULL] = { |
|---|
| 714 | 712 | .pc_func = nfsd3_proc_null, |
|---|
| 713 | + .pc_decode = nfs3svc_decode_voidarg, |
|---|
| 715 | 714 | .pc_encode = nfs3svc_encode_voidres, |
|---|
| 716 | 715 | .pc_argsize = sizeof(struct nfsd3_voidargs), |
|---|
| 717 | 716 | .pc_ressize = sizeof(struct nfsd3_voidres), |
|---|