diff options
| -rw-r--r-- | fs/nfsd/nfs4proc.c | 24 | ||||
| -rw-r--r-- | fs/nfsd/nfs4state.c | 30 | ||||
| -rw-r--r-- | include/linux/nfsd/xdr4.h | 15 |
3 files changed, 40 insertions, 29 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index e08edc17c6a0..361b4007d4a0 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
| @@ -162,7 +162,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ | |||
| 162 | 162 | ||
| 163 | 163 | ||
| 164 | static inline int | 164 | static inline int |
| 165 | nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | 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 | int status; |
| 168 | dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", | 168 | dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", |
| @@ -238,8 +238,10 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open | |||
| 238 | */ | 238 | */ |
| 239 | status = nfsd4_process_open2(rqstp, current_fh, open); | 239 | status = nfsd4_process_open2(rqstp, current_fh, open); |
| 240 | out: | 240 | out: |
| 241 | if (open->op_stateowner) | 241 | if (open->op_stateowner) { |
| 242 | nfs4_get_stateowner(open->op_stateowner); | 242 | nfs4_get_stateowner(open->op_stateowner); |
| 243 | *replay_owner = open->op_stateowner; | ||
| 244 | } | ||
| 243 | nfs4_unlock_state(); | 245 | nfs4_unlock_state(); |
| 244 | return status; | 246 | return status; |
| 245 | } | 247 | } |
| @@ -809,8 +811,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
| 809 | op->status = nfsd4_access(rqstp, current_fh, &op->u.access); | 811 | op->status = nfsd4_access(rqstp, current_fh, &op->u.access); |
| 810 | break; | 812 | break; |
| 811 | case OP_CLOSE: | 813 | case OP_CLOSE: |
| 812 | op->status = nfsd4_close(rqstp, current_fh, &op->u.close); | 814 | op->status = nfsd4_close(rqstp, current_fh, &op->u.close, &replay_owner); |
| 813 | replay_owner = op->u.close.cl_stateowner; | ||
| 814 | break; | 815 | break; |
| 815 | case OP_COMMIT: | 816 | case OP_COMMIT: |
| 816 | op->status = nfsd4_commit(rqstp, current_fh, &op->u.commit); | 817 | op->status = nfsd4_commit(rqstp, current_fh, &op->u.commit); |
| @@ -831,15 +832,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
| 831 | op->status = nfsd4_link(rqstp, current_fh, save_fh, &op->u.link); | 832 | op->status = nfsd4_link(rqstp, current_fh, save_fh, &op->u.link); |
| 832 | break; | 833 | break; |
| 833 | case OP_LOCK: | 834 | case OP_LOCK: |
| 834 | op->status = nfsd4_lock(rqstp, current_fh, &op->u.lock); | 835 | op->status = nfsd4_lock(rqstp, current_fh, &op->u.lock, &replay_owner); |
| 835 | replay_owner = op->u.lock.lk_stateowner; | ||
| 836 | break; | 836 | break; |
| 837 | case OP_LOCKT: | 837 | case OP_LOCKT: |
| 838 | op->status = nfsd4_lockt(rqstp, current_fh, &op->u.lockt); | 838 | op->status = nfsd4_lockt(rqstp, current_fh, &op->u.lockt); |
| 839 | break; | 839 | break; |
| 840 | case OP_LOCKU: | 840 | case OP_LOCKU: |
| 841 | op->status = nfsd4_locku(rqstp, current_fh, &op->u.locku); | 841 | op->status = nfsd4_locku(rqstp, current_fh, &op->u.locku, &replay_owner); |
| 842 | replay_owner = op->u.locku.lu_stateowner; | ||
| 843 | break; | 842 | break; |
| 844 | case OP_LOOKUP: | 843 | case OP_LOOKUP: |
| 845 | op->status = nfsd4_lookup(rqstp, current_fh, &op->u.lookup); | 844 | op->status = nfsd4_lookup(rqstp, current_fh, &op->u.lookup); |
| @@ -853,16 +852,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, | |||
| 853 | op->status = nfs_ok; | 852 | op->status = nfs_ok; |
| 854 | break; | 853 | break; |
| 855 | case OP_OPEN: | 854 | case OP_OPEN: |
| 856 | op->status = nfsd4_open(rqstp, current_fh, &op->u.open); | 855 | op->status = nfsd4_open(rqstp, current_fh, &op->u.open, &replay_owner); |
| 857 | replay_owner = op->u.open.op_stateowner; | ||
| 858 | break; | 856 | break; |
| 859 | case OP_OPEN_CONFIRM: | 857 | case OP_OPEN_CONFIRM: |
| 860 | op->status = nfsd4_open_confirm(rqstp, current_fh, &op->u.open_confirm); | 858 | op->status = nfsd4_open_confirm(rqstp, current_fh, &op->u.open_confirm, &replay_owner); |
| 861 | replay_owner = op->u.open_confirm.oc_stateowner; | ||
| 862 | break; | 859 | break; |
| 863 | case OP_OPEN_DOWNGRADE: | 860 | case OP_OPEN_DOWNGRADE: |
| 864 | op->status = nfsd4_open_downgrade(rqstp, current_fh, &op->u.open_downgrade); | 861 | op->status = nfsd4_open_downgrade(rqstp, current_fh, &op->u.open_downgrade, &replay_owner); |
| 865 | replay_owner = op->u.open_downgrade.od_stateowner; | ||
| 866 | break; | 862 | break; |
| 867 | case OP_PUTFH: | 863 | case OP_PUTFH: |
| 868 | op->status = nfsd4_putfh(rqstp, current_fh, &op->u.putfh); | 864 | op->status = nfsd4_putfh(rqstp, current_fh, &op->u.putfh); |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 109fd8c3d4f5..11405e530e70 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -2286,7 +2286,7 @@ check_replay: | |||
| 2286 | } | 2286 | } |
| 2287 | 2287 | ||
| 2288 | int | 2288 | int |
| 2289 | nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc) | 2289 | nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, struct nfs4_stateowner **replay_owner) |
| 2290 | { | 2290 | { |
| 2291 | int status; | 2291 | int status; |
| 2292 | struct nfs4_stateowner *sop; | 2292 | struct nfs4_stateowner *sop; |
| @@ -2320,8 +2320,10 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs | |||
| 2320 | 2320 | ||
| 2321 | nfsd4_create_clid_dir(sop->so_client); | 2321 | nfsd4_create_clid_dir(sop->so_client); |
| 2322 | out: | 2322 | out: |
| 2323 | if (oc->oc_stateowner) | 2323 | if (oc->oc_stateowner) { |
| 2324 | nfs4_get_stateowner(oc->oc_stateowner); | 2324 | nfs4_get_stateowner(oc->oc_stateowner); |
| 2325 | *replay_owner = oc->oc_stateowner; | ||
| 2326 | } | ||
| 2325 | nfs4_unlock_state(); | 2327 | nfs4_unlock_state(); |
| 2326 | return status; | 2328 | return status; |
| 2327 | } | 2329 | } |
| @@ -2352,7 +2354,7 @@ reset_union_bmap_deny(unsigned long deny, unsigned long *bmap) | |||
| 2352 | } | 2354 | } |
| 2353 | 2355 | ||
| 2354 | int | 2356 | int |
| 2355 | nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od) | 2357 | nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, struct nfs4_stateowner **replay_owner) |
| 2356 | { | 2358 | { |
| 2357 | int status; | 2359 | int status; |
| 2358 | struct nfs4_stateid *stp; | 2360 | struct nfs4_stateid *stp; |
| @@ -2394,8 +2396,10 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n | |||
| 2394 | memcpy(&od->od_stateid, &stp->st_stateid, sizeof(stateid_t)); | 2396 | memcpy(&od->od_stateid, &stp->st_stateid, sizeof(stateid_t)); |
| 2395 | status = nfs_ok; | 2397 | status = nfs_ok; |
| 2396 | out: | 2398 | out: |
| 2397 | if (od->od_stateowner) | 2399 | if (od->od_stateowner) { |
| 2398 | nfs4_get_stateowner(od->od_stateowner); | 2400 | nfs4_get_stateowner(od->od_stateowner); |
| 2401 | *replay_owner = od->od_stateowner; | ||
| 2402 | } | ||
| 2399 | nfs4_unlock_state(); | 2403 | nfs4_unlock_state(); |
| 2400 | return status; | 2404 | return status; |
| 2401 | } | 2405 | } |
| @@ -2404,7 +2408,7 @@ out: | |||
| 2404 | * nfs4_unlock_state() called after encode | 2408 | * nfs4_unlock_state() called after encode |
| 2405 | */ | 2409 | */ |
| 2406 | int | 2410 | int |
| 2407 | nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close) | 2411 | nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close, struct nfs4_stateowner **replay_owner) |
| 2408 | { | 2412 | { |
| 2409 | int status; | 2413 | int status; |
| 2410 | struct nfs4_stateid *stp; | 2414 | struct nfs4_stateid *stp; |
| @@ -2430,8 +2434,10 @@ nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_clos | |||
| 2430 | /* release_state_owner() calls nfsd_close() if needed */ | 2434 | /* release_state_owner() calls nfsd_close() if needed */ |
| 2431 | release_state_owner(stp, OPEN_STATE); | 2435 | release_state_owner(stp, OPEN_STATE); |
| 2432 | out: | 2436 | out: |
| 2433 | if (close->cl_stateowner) | 2437 | if (close->cl_stateowner) { |
| 2434 | nfs4_get_stateowner(close->cl_stateowner); | 2438 | nfs4_get_stateowner(close->cl_stateowner); |
| 2439 | *replay_owner = close->cl_stateowner; | ||
| 2440 | } | ||
| 2435 | nfs4_unlock_state(); | 2441 | nfs4_unlock_state(); |
| 2436 | return status; | 2442 | return status; |
| 2437 | } | 2443 | } |
| @@ -2675,7 +2681,7 @@ check_lock_length(u64 offset, u64 length) | |||
| 2675 | * LOCK operation | 2681 | * LOCK operation |
| 2676 | */ | 2682 | */ |
| 2677 | int | 2683 | int |
| 2678 | nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock) | 2684 | nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner) |
| 2679 | { | 2685 | { |
| 2680 | struct nfs4_stateowner *open_sop = NULL; | 2686 | struct nfs4_stateowner *open_sop = NULL; |
| 2681 | struct nfs4_stateid *lock_stp; | 2687 | struct nfs4_stateid *lock_stp; |
| @@ -2835,8 +2841,10 @@ out_destroy_new_stateid: | |||
| 2835 | release_state_owner(lock_stp, LOCK_STATE); | 2841 | release_state_owner(lock_stp, LOCK_STATE); |
| 2836 | } | 2842 | } |
| 2837 | out: | 2843 | out: |
| 2838 | if (lock->lk_stateowner) | 2844 | if (lock->lk_stateowner) { |
| 2839 | nfs4_get_stateowner(lock->lk_stateowner); | 2845 | nfs4_get_stateowner(lock->lk_stateowner); |
| 2846 | *replay_owner = lock->lk_stateowner; | ||
| 2847 | } | ||
| 2840 | nfs4_unlock_state(); | 2848 | nfs4_unlock_state(); |
| 2841 | return status; | 2849 | return status; |
| 2842 | } | 2850 | } |
| @@ -2925,7 +2933,7 @@ out: | |||
| 2925 | } | 2933 | } |
| 2926 | 2934 | ||
| 2927 | int | 2935 | int |
| 2928 | nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku) | 2936 | nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku, struct nfs4_stateowner **replay_owner) |
| 2929 | { | 2937 | { |
| 2930 | struct nfs4_stateid *stp; | 2938 | struct nfs4_stateid *stp; |
| 2931 | struct file *filp = NULL; | 2939 | struct file *filp = NULL; |
| @@ -2981,8 +2989,10 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock | |||
| 2981 | memcpy(&locku->lu_stateid, &stp->st_stateid, sizeof(stateid_t)); | 2989 | memcpy(&locku->lu_stateid, &stp->st_stateid, sizeof(stateid_t)); |
| 2982 | 2990 | ||
| 2983 | out: | 2991 | out: |
| 2984 | if (locku->lu_stateowner) | 2992 | if (locku->lu_stateowner) { |
| 2985 | nfs4_get_stateowner(locku->lu_stateowner); | 2993 | nfs4_get_stateowner(locku->lu_stateowner); |
| 2994 | *replay_owner = locku->lu_stateowner; | ||
| 2995 | } | ||
| 2986 | nfs4_unlock_state(); | 2996 | nfs4_unlock_state(); |
| 2987 | return status; | 2997 | return status; |
| 2988 | 2998 | ||
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h index 4d24d65c0e88..8903688890ce 100644 --- a/include/linux/nfsd/xdr4.h +++ b/include/linux/nfsd/xdr4.h | |||
| @@ -438,17 +438,22 @@ extern int nfsd4_process_open1(struct nfsd4_open *open); | |||
| 438 | extern int nfsd4_process_open2(struct svc_rqst *rqstp, | 438 | extern int nfsd4_process_open2(struct svc_rqst *rqstp, |
| 439 | struct svc_fh *current_fh, struct nfsd4_open *open); | 439 | struct svc_fh *current_fh, struct nfsd4_open *open); |
| 440 | extern int nfsd4_open_confirm(struct svc_rqst *rqstp, | 440 | extern int nfsd4_open_confirm(struct svc_rqst *rqstp, |
| 441 | struct svc_fh *current_fh, struct nfsd4_open_confirm *oc); | 441 | struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, |
| 442 | struct nfs4_stateowner **); | ||
| 442 | extern int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, | 443 | extern int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, |
| 443 | struct nfsd4_close *close); | 444 | struct nfsd4_close *close, |
| 445 | struct nfs4_stateowner **replay_owner); | ||
| 444 | extern int nfsd4_open_downgrade(struct svc_rqst *rqstp, | 446 | extern int nfsd4_open_downgrade(struct svc_rqst *rqstp, |
| 445 | struct svc_fh *current_fh, struct nfsd4_open_downgrade *od); | 447 | struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, |
| 448 | struct nfs4_stateowner **replay_owner); | ||
| 446 | extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, | 449 | extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, |
| 447 | struct nfsd4_lock *lock); | 450 | struct nfsd4_lock *lock, |
| 451 | struct nfs4_stateowner **replay_owner); | ||
| 448 | extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, | 452 | extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, |
| 449 | struct nfsd4_lockt *lockt); | 453 | struct nfsd4_lockt *lockt); |
| 450 | extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, | 454 | extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, |
| 451 | struct nfsd4_locku *locku); | 455 | struct nfsd4_locku *locku, |
| 456 | struct nfs4_stateowner **replay_owner); | ||
| 452 | extern int | 457 | extern int |
| 453 | nfsd4_release_lockowner(struct svc_rqst *rqstp, | 458 | nfsd4_release_lockowner(struct svc_rqst *rqstp, |
| 454 | struct nfsd4_release_lockowner *rlockowner); | 459 | struct nfsd4_release_lockowner *rlockowner); |
