diff options
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r-- | fs/nfsd/nfs4proc.c | 140 |
1 files changed, 78 insertions, 62 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 15ded7a30a72..0a7bbdc4a10a 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -67,32 +67,32 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src) | |||
67 | *dst = *src; | 67 | *dst = *src; |
68 | } | 68 | } |
69 | 69 | ||
70 | static int | 70 | static __be32 |
71 | do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | 71 | do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode) |
72 | { | 72 | { |
73 | int accmode, status; | 73 | __be32 status; |
74 | 74 | ||
75 | if (open->op_truncate && | 75 | if (open->op_truncate && |
76 | !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) | 76 | !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) |
77 | return nfserr_inval; | 77 | return nfserr_inval; |
78 | 78 | ||
79 | accmode = MAY_NOP; | ||
80 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) | 79 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) |
81 | accmode = MAY_READ; | 80 | accmode |= MAY_READ; |
82 | if (open->op_share_deny & NFS4_SHARE_ACCESS_WRITE) | 81 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) |
83 | accmode |= (MAY_WRITE | MAY_TRUNC); | 82 | accmode |= (MAY_WRITE | MAY_TRUNC); |
84 | accmode |= MAY_OWNER_OVERRIDE; | 83 | if (open->op_share_deny & NFS4_SHARE_DENY_WRITE) |
84 | accmode |= MAY_WRITE; | ||
85 | 85 | ||
86 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); | 86 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); |
87 | 87 | ||
88 | return status; | 88 | return status; |
89 | } | 89 | } |
90 | 90 | ||
91 | static int | 91 | static __be32 |
92 | do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | 92 | do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) |
93 | { | 93 | { |
94 | struct svc_fh resfh; | 94 | struct svc_fh resfh; |
95 | int status; | 95 | __be32 status; |
96 | 96 | ||
97 | fh_init(&resfh, NFS4_FHSIZE); | 97 | fh_init(&resfh, NFS4_FHSIZE); |
98 | open->op_truncate = 0; | 98 | open->op_truncate = 0; |
@@ -124,17 +124,17 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | |||
124 | &resfh.fh_handle.fh_base, | 124 | &resfh.fh_handle.fh_base, |
125 | resfh.fh_handle.fh_size); | 125 | resfh.fh_handle.fh_size); |
126 | 126 | ||
127 | status = do_open_permission(rqstp, current_fh, open); | 127 | status = do_open_permission(rqstp, current_fh, open, MAY_NOP); |
128 | } | 128 | } |
129 | 129 | ||
130 | fh_put(&resfh); | 130 | fh_put(&resfh); |
131 | return status; | 131 | return status; |
132 | } | 132 | } |
133 | 133 | ||
134 | static int | 134 | static __be32 |
135 | do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | 135 | do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) |
136 | { | 136 | { |
137 | int status; | 137 | __be32 status; |
138 | 138 | ||
139 | /* Only reclaims from previously confirmed clients are valid */ | 139 | /* Only reclaims from previously confirmed clients are valid */ |
140 | if ((status = nfs4_check_open_reclaim(&open->op_clientid))) | 140 | if ((status = nfs4_check_open_reclaim(&open->op_clientid))) |
@@ -155,16 +155,16 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ | |||
155 | open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && | 155 | open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && |
156 | (open->op_iattr.ia_size == 0); | 156 | (open->op_iattr.ia_size == 0); |
157 | 157 | ||
158 | status = do_open_permission(rqstp, current_fh, open); | 158 | status = do_open_permission(rqstp, current_fh, open, MAY_OWNER_OVERRIDE); |
159 | 159 | ||
160 | return status; | 160 | return status; |
161 | } | 161 | } |
162 | 162 | ||
163 | 163 | ||
164 | static inline int | 164 | static inline __be32 |
165 | nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner) | 165 | nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner) |
166 | { | 166 | { |
167 | int status; | 167 | __be32 status; |
168 | dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", | 168 | dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", |
169 | (int)open->op_fname.len, open->op_fname.data, | 169 | (int)open->op_fname.len, open->op_fname.data, |
170 | open->op_stateowner); | 170 | open->op_stateowner); |
@@ -177,7 +177,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open | |||
177 | 177 | ||
178 | /* check seqid for replay. set nfs4_owner */ | 178 | /* check seqid for replay. set nfs4_owner */ |
179 | status = nfsd4_process_open1(open); | 179 | status = nfsd4_process_open1(open); |
180 | if (status == NFSERR_REPLAY_ME) { | 180 | if (status == nfserr_replay_me) { |
181 | struct nfs4_replay *rp = &open->op_stateowner->so_replay; | 181 | struct nfs4_replay *rp = &open->op_stateowner->so_replay; |
182 | fh_put(current_fh); | 182 | fh_put(current_fh); |
183 | current_fh->fh_handle.fh_size = rp->rp_openfh_len; | 183 | current_fh->fh_handle.fh_size = rp->rp_openfh_len; |
@@ -188,7 +188,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open | |||
188 | dprintk("nfsd4_open: replay failed" | 188 | dprintk("nfsd4_open: replay failed" |
189 | " restoring previous filehandle\n"); | 189 | " restoring previous filehandle\n"); |
190 | else | 190 | else |
191 | status = NFSERR_REPLAY_ME; | 191 | status = nfserr_replay_me; |
192 | } | 192 | } |
193 | if (status) | 193 | if (status) |
194 | goto out; | 194 | goto out; |
@@ -261,7 +261,7 @@ out: | |||
261 | /* | 261 | /* |
262 | * filehandle-manipulating ops. | 262 | * filehandle-manipulating ops. |
263 | */ | 263 | */ |
264 | static inline int | 264 | static inline __be32 |
265 | nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh) | 265 | nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh) |
266 | { | 266 | { |
267 | if (!current_fh->fh_dentry) | 267 | if (!current_fh->fh_dentry) |
@@ -271,7 +271,7 @@ nfsd4_getfh(struct svc_fh *current_fh, struct svc_fh **getfh) | |||
271 | return nfs_ok; | 271 | return nfs_ok; |
272 | } | 272 | } |
273 | 273 | ||
274 | static inline int | 274 | static inline __be32 |
275 | nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh) | 275 | nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putfh *putfh) |
276 | { | 276 | { |
277 | fh_put(current_fh); | 277 | fh_put(current_fh); |
@@ -280,10 +280,10 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putf | |||
280 | return fh_verify(rqstp, current_fh, 0, MAY_NOP); | 280 | return fh_verify(rqstp, current_fh, 0, MAY_NOP); |
281 | } | 281 | } |
282 | 282 | ||
283 | static inline int | 283 | static inline __be32 |
284 | nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh) | 284 | nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh) |
285 | { | 285 | { |
286 | int status; | 286 | __be32 status; |
287 | 287 | ||
288 | fh_put(current_fh); | 288 | fh_put(current_fh); |
289 | status = exp_pseudoroot(rqstp->rq_client, current_fh, | 289 | status = exp_pseudoroot(rqstp->rq_client, current_fh, |
@@ -291,7 +291,7 @@ nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh) | |||
291 | return status; | 291 | return status; |
292 | } | 292 | } |
293 | 293 | ||
294 | static inline int | 294 | static inline __be32 |
295 | nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh) | 295 | nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh) |
296 | { | 296 | { |
297 | if (!save_fh->fh_dentry) | 297 | if (!save_fh->fh_dentry) |
@@ -301,7 +301,7 @@ nfsd4_restorefh(struct svc_fh *current_fh, struct svc_fh *save_fh) | |||
301 | return nfs_ok; | 301 | return nfs_ok; |
302 | } | 302 | } |
303 | 303 | ||
304 | static inline int | 304 | static inline __be32 |
305 | nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh) | 305 | nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh) |
306 | { | 306 | { |
307 | if (!current_fh->fh_dentry) | 307 | if (!current_fh->fh_dentry) |
@@ -314,7 +314,7 @@ nfsd4_savefh(struct svc_fh *current_fh, struct svc_fh *save_fh) | |||
314 | /* | 314 | /* |
315 | * misc nfsv4 ops | 315 | * misc nfsv4 ops |
316 | */ | 316 | */ |
317 | static inline int | 317 | static inline __be32 |
318 | nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access) | 318 | nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_access *access) |
319 | { | 319 | { |
320 | if (access->ac_req_access & ~NFS3_ACCESS_FULL) | 320 | if (access->ac_req_access & ~NFS3_ACCESS_FULL) |
@@ -324,10 +324,10 @@ nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_acc | |||
324 | return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported); | 324 | return nfsd_access(rqstp, current_fh, &access->ac_resp_access, &access->ac_supported); |
325 | } | 325 | } |
326 | 326 | ||
327 | static inline int | 327 | static inline __be32 |
328 | nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit) | 328 | nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit) |
329 | { | 329 | { |
330 | int status; | 330 | __be32 status; |
331 | 331 | ||
332 | u32 *p = (u32 *)commit->co_verf.data; | 332 | u32 *p = (u32 *)commit->co_verf.data; |
333 | *p++ = nfssvc_boot.tv_sec; | 333 | *p++ = nfssvc_boot.tv_sec; |
@@ -339,11 +339,11 @@ nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_com | |||
339 | return status; | 339 | return status; |
340 | } | 340 | } |
341 | 341 | ||
342 | static int | 342 | static __be32 |
343 | nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create) | 343 | nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_create *create) |
344 | { | 344 | { |
345 | struct svc_fh resfh; | 345 | struct svc_fh resfh; |
346 | int status; | 346 | __be32 status; |
347 | dev_t rdev; | 347 | dev_t rdev; |
348 | 348 | ||
349 | fh_init(&resfh, NFS4_FHSIZE); | 349 | fh_init(&resfh, NFS4_FHSIZE); |
@@ -423,10 +423,10 @@ nfsd4_create(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_cre | |||
423 | return status; | 423 | return status; |
424 | } | 424 | } |
425 | 425 | ||
426 | static inline int | 426 | static inline __be32 |
427 | nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr) | 427 | nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_getattr *getattr) |
428 | { | 428 | { |
429 | int status; | 429 | __be32 status; |
430 | 430 | ||
431 | status = fh_verify(rqstp, current_fh, 0, MAY_NOP); | 431 | status = fh_verify(rqstp, current_fh, 0, MAY_NOP); |
432 | if (status) | 432 | if (status) |
@@ -442,11 +442,11 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ge | |||
442 | return nfs_ok; | 442 | return nfs_ok; |
443 | } | 443 | } |
444 | 444 | ||
445 | static inline int | 445 | static inline __be32 |
446 | nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh, | 446 | nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh, |
447 | struct svc_fh *save_fh, struct nfsd4_link *link) | 447 | struct svc_fh *save_fh, struct nfsd4_link *link) |
448 | { | 448 | { |
449 | int status = nfserr_nofilehandle; | 449 | __be32 status = nfserr_nofilehandle; |
450 | 450 | ||
451 | if (!save_fh->fh_dentry) | 451 | if (!save_fh->fh_dentry) |
452 | return status; | 452 | return status; |
@@ -456,11 +456,11 @@ nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh, | |||
456 | return status; | 456 | return status; |
457 | } | 457 | } |
458 | 458 | ||
459 | static int | 459 | static __be32 |
460 | nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh) | 460 | nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh) |
461 | { | 461 | { |
462 | struct svc_fh tmp_fh; | 462 | struct svc_fh tmp_fh; |
463 | int ret; | 463 | __be32 ret; |
464 | 464 | ||
465 | fh_init(&tmp_fh, NFS4_FHSIZE); | 465 | fh_init(&tmp_fh, NFS4_FHSIZE); |
466 | if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh, | 466 | if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh, |
@@ -474,16 +474,16 @@ nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh) | |||
474 | return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh); | 474 | return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh); |
475 | } | 475 | } |
476 | 476 | ||
477 | static inline int | 477 | static inline __be32 |
478 | nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup) | 478 | nfsd4_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lookup *lookup) |
479 | { | 479 | { |
480 | return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh); | 480 | return nfsd_lookup(rqstp, current_fh, lookup->lo_name, lookup->lo_len, current_fh); |
481 | } | 481 | } |
482 | 482 | ||
483 | static inline int | 483 | static inline __be32 |
484 | nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read) | 484 | nfsd4_read(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_read *read) |
485 | { | 485 | { |
486 | int status; | 486 | __be32 status; |
487 | 487 | ||
488 | /* no need to check permission - this will be done in nfsd_read() */ | 488 | /* no need to check permission - this will be done in nfsd_read() */ |
489 | 489 | ||
@@ -508,7 +508,7 @@ out: | |||
508 | return status; | 508 | return status; |
509 | } | 509 | } |
510 | 510 | ||
511 | static inline int | 511 | static inline __be32 |
512 | nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir) | 512 | nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readdir *readdir) |
513 | { | 513 | { |
514 | u64 cookie = readdir->rd_cookie; | 514 | u64 cookie = readdir->rd_cookie; |
@@ -531,7 +531,7 @@ nfsd4_readdir(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_re | |||
531 | return nfs_ok; | 531 | return nfs_ok; |
532 | } | 532 | } |
533 | 533 | ||
534 | static inline int | 534 | static inline __be32 |
535 | nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink) | 535 | nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_readlink *readlink) |
536 | { | 536 | { |
537 | readlink->rl_rqstp = rqstp; | 537 | readlink->rl_rqstp = rqstp; |
@@ -539,10 +539,10 @@ nfsd4_readlink(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_r | |||
539 | return nfs_ok; | 539 | return nfs_ok; |
540 | } | 540 | } |
541 | 541 | ||
542 | static inline int | 542 | static inline __be32 |
543 | nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove) | 543 | nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_remove *remove) |
544 | { | 544 | { |
545 | int status; | 545 | __be32 status; |
546 | 546 | ||
547 | if (nfs4_in_grace()) | 547 | if (nfs4_in_grace()) |
548 | return nfserr_grace; | 548 | return nfserr_grace; |
@@ -556,11 +556,11 @@ nfsd4_remove(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_rem | |||
556 | return status; | 556 | return status; |
557 | } | 557 | } |
558 | 558 | ||
559 | static inline int | 559 | static inline __be32 |
560 | nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, | 560 | nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, |
561 | struct svc_fh *save_fh, struct nfsd4_rename *rename) | 561 | struct svc_fh *save_fh, struct nfsd4_rename *rename) |
562 | { | 562 | { |
563 | int status = nfserr_nofilehandle; | 563 | __be32 status = nfserr_nofilehandle; |
564 | 564 | ||
565 | if (!save_fh->fh_dentry) | 565 | if (!save_fh->fh_dentry) |
566 | return status; | 566 | return status; |
@@ -589,10 +589,10 @@ nfsd4_rename(struct svc_rqst *rqstp, struct svc_fh *current_fh, | |||
589 | return status; | 589 | return status; |
590 | } | 590 | } |
591 | 591 | ||
592 | static inline int | 592 | static inline __be32 |
593 | nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr) | 593 | nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_setattr *setattr) |
594 | { | 594 | { |
595 | int status = nfs_ok; | 595 | __be32 status = nfs_ok; |
596 | 596 | ||
597 | if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { | 597 | if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { |
598 | nfs4_lock_state(); | 598 | nfs4_lock_state(); |
@@ -614,13 +614,13 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_se | |||
614 | return status; | 614 | return status; |
615 | } | 615 | } |
616 | 616 | ||
617 | static inline int | 617 | static inline __be32 |
618 | nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write) | 618 | nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_write *write) |
619 | { | 619 | { |
620 | stateid_t *stateid = &write->wr_stateid; | 620 | stateid_t *stateid = &write->wr_stateid; |
621 | struct file *filp = NULL; | 621 | struct file *filp = NULL; |
622 | u32 *p; | 622 | u32 *p; |
623 | int status = nfs_ok; | 623 | __be32 status = nfs_ok; |
624 | 624 | ||
625 | /* no need to check permission - this will be done in nfsd_write() */ | 625 | /* no need to check permission - this will be done in nfsd_write() */ |
626 | 626 | ||
@@ -646,7 +646,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ | |||
646 | *p++ = nfssvc_boot.tv_usec; | 646 | *p++ = nfssvc_boot.tv_usec; |
647 | 647 | ||
648 | status = nfsd_write(rqstp, current_fh, filp, write->wr_offset, | 648 | status = nfsd_write(rqstp, current_fh, filp, write->wr_offset, |
649 | write->wr_vec, write->wr_vlen, write->wr_buflen, | 649 | rqstp->rq_vec, write->wr_vlen, write->wr_buflen, |
650 | &write->wr_how_written); | 650 | &write->wr_how_written); |
651 | if (filp) | 651 | if (filp) |
652 | fput(filp); | 652 | fput(filp); |
@@ -661,12 +661,12 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ | |||
661 | * attributes matched. VERIFY is implemented by mapping NFSERR_SAME | 661 | * attributes matched. VERIFY is implemented by mapping NFSERR_SAME |
662 | * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK. | 662 | * to NFS_OK after the call; NVERIFY by mapping NFSERR_NOT_SAME to NFS_OK. |
663 | */ | 663 | */ |
664 | static int | 664 | static __be32 |
665 | nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify) | 665 | nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_verify *verify) |
666 | { | 666 | { |
667 | u32 *buf, *p; | 667 | __be32 *buf, *p; |
668 | int count; | 668 | int count; |
669 | int status; | 669 | __be32 status; |
670 | 670 | ||
671 | status = fh_verify(rqstp, current_fh, 0, MAY_NOP); | 671 | status = fh_verify(rqstp, current_fh, 0, MAY_NOP); |
672 | if (status) | 672 | if (status) |
@@ -715,7 +715,7 @@ out_kfree: | |||
715 | /* | 715 | /* |
716 | * NULL call. | 716 | * NULL call. |
717 | */ | 717 | */ |
718 | static int | 718 | static __be32 |
719 | nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) | 719 | nfsd4_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) |
720 | { | 720 | { |
721 | return nfs_ok; | 721 | return nfs_ok; |
@@ -731,7 +731,7 @@ static inline void nfsd4_increment_op_stats(u32 opnum) | |||
731 | /* | 731 | /* |
732 | * COMPOUND call. | 732 | * COMPOUND call. |
733 | */ | 733 | */ |
734 | static int | 734 | static __be32 |
735 | nfsd4_proc_compound(struct svc_rqst *rqstp, | 735 | nfsd4_proc_compound(struct svc_rqst *rqstp, |
736 | struct nfsd4_compoundargs *args, | 736 | struct nfsd4_compoundargs *args, |
737 | struct nfsd4_compoundres *resp) | 737 | struct nfsd4_compoundres *resp) |
@@ -741,7 +741,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
741 | struct svc_fh *save_fh = NULL; | 741 | struct svc_fh *save_fh = NULL; |
742 | struct nfs4_stateowner *replay_owner = NULL; | 742 | struct nfs4_stateowner *replay_owner = NULL; |
743 | int slack_space; /* in words, not bytes! */ | 743 | int slack_space; /* in words, not bytes! */ |
744 | int status; | 744 | __be32 status; |
745 | 745 | ||
746 | status = nfserr_resource; | 746 | status = nfserr_resource; |
747 | current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL); | 747 | current_fh = kmalloc(sizeof(*current_fh), GFP_KERNEL); |
@@ -802,13 +802,29 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
802 | * SETCLIENTID_CONFIRM, PUTFH and PUTROOTFH | 802 | * SETCLIENTID_CONFIRM, PUTFH and PUTROOTFH |
803 | * require a valid current filehandle | 803 | * require a valid current filehandle |
804 | */ | 804 | */ |
805 | if ((!current_fh->fh_dentry) && | 805 | if (!current_fh->fh_dentry) { |
806 | !((op->opnum == OP_PUTFH) || (op->opnum == OP_PUTROOTFH) || | 806 | if (!((op->opnum == OP_PUTFH) || |
807 | (op->opnum == OP_SETCLIENTID) || | 807 | (op->opnum == OP_PUTROOTFH) || |
808 | (op->opnum == OP_SETCLIENTID_CONFIRM) || | 808 | (op->opnum == OP_SETCLIENTID) || |
809 | (op->opnum == OP_RENEW) || (op->opnum == OP_RESTOREFH) || | 809 | (op->opnum == OP_SETCLIENTID_CONFIRM) || |
810 | (op->opnum == OP_RELEASE_LOCKOWNER))) { | 810 | (op->opnum == OP_RENEW) || |
811 | op->status = nfserr_nofilehandle; | 811 | (op->opnum == OP_RESTOREFH) || |
812 | (op->opnum == OP_RELEASE_LOCKOWNER))) { | ||
813 | op->status = nfserr_nofilehandle; | ||
814 | goto encode_op; | ||
815 | } | ||
816 | } | ||
817 | /* Check must be done at start of each operation, except | ||
818 | * for GETATTR and ops not listed as returning NFS4ERR_MOVED | ||
819 | */ | ||
820 | else if (current_fh->fh_export->ex_fslocs.migrated && | ||
821 | !((op->opnum == OP_GETATTR) || | ||
822 | (op->opnum == OP_PUTROOTFH) || | ||
823 | (op->opnum == OP_PUTPUBFH) || | ||
824 | (op->opnum == OP_RENEW) || | ||
825 | (op->opnum == OP_SETCLIENTID) || | ||
826 | (op->opnum == OP_RELEASE_LOCKOWNER))) { | ||
827 | op->status = nfserr_moved; | ||
812 | goto encode_op; | 828 | goto encode_op; |
813 | } | 829 | } |
814 | switch (op->opnum) { | 830 | switch (op->opnum) { |
@@ -921,7 +937,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
921 | } | 937 | } |
922 | 938 | ||
923 | encode_op: | 939 | encode_op: |
924 | if (op->status == NFSERR_REPLAY_ME) { | 940 | if (op->status == nfserr_replay_me) { |
925 | op->replay = &replay_owner->so_replay; | 941 | op->replay = &replay_owner->so_replay; |
926 | nfsd4_encode_replay(resp, op); | 942 | nfsd4_encode_replay(resp, op); |
927 | status = op->status = op->replay->rp_status; | 943 | status = op->status = op->replay->rp_status; |