diff options
| author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-11-14 10:22:07 -0500 |
|---|---|---|
| committer | J. Bruce Fields <bfields@redhat.com> | 2012-11-15 07:40:50 -0500 |
| commit | 3320fef19b542b8df9606bd8e63990dc2a3fb330 (patch) | |
| tree | fe68d7d40178040eb8691fffb711d7c413a6ce9e | |
| parent | 73758fed711b847d833b9b0db59137eaeed06485 (diff) | |
nfsd: use service net instead of hard-coded init_net
This patch replaces init_net by SVC_NET(), where possible and also passes
proper context to nested functions where required.
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| -rw-r--r-- | fs/nfsd/nfs4proc.c | 13 | ||||
| -rw-r--r-- | fs/nfsd/nfs4state.c | 63 | ||||
| -rw-r--r-- | fs/nfsd/state.h | 2 | ||||
| -rw-r--r-- | fs/nfsd/xdr4.h | 2 |
4 files changed, 49 insertions, 31 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index f955176f1b6f..1d2396b79574 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | #include "xdr4.h" | 40 | #include "xdr4.h" |
| 41 | #include "vfs.h" | 41 | #include "vfs.h" |
| 42 | #include "current_stateid.h" | 42 | #include "current_stateid.h" |
| 43 | #include "netns.h" | ||
| 43 | 44 | ||
| 44 | #define NFSDDBG_FACILITY NFSDDBG_PROC | 45 | #define NFSDDBG_FACILITY NFSDDBG_PROC |
| 45 | 46 | ||
| @@ -304,6 +305,8 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 304 | { | 305 | { |
| 305 | __be32 status; | 306 | __be32 status; |
| 306 | struct nfsd4_compoundres *resp; | 307 | struct nfsd4_compoundres *resp; |
| 308 | struct net *net = SVC_NET(rqstp); | ||
| 309 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
| 307 | 310 | ||
| 308 | dprintk("NFSD: nfsd4_open filename %.*s op_openowner %p\n", | 311 | dprintk("NFSD: nfsd4_open filename %.*s op_openowner %p\n", |
| 309 | (int)open->op_fname.len, open->op_fname.data, | 312 | (int)open->op_fname.len, open->op_fname.data, |
| @@ -331,7 +334,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 331 | 334 | ||
| 332 | /* check seqid for replay. set nfs4_owner */ | 335 | /* check seqid for replay. set nfs4_owner */ |
| 333 | resp = rqstp->rq_resp; | 336 | resp = rqstp->rq_resp; |
| 334 | status = nfsd4_process_open1(&resp->cstate, open); | 337 | status = nfsd4_process_open1(&resp->cstate, open, nn); |
| 335 | if (status == nfserr_replay_me) { | 338 | if (status == nfserr_replay_me) { |
| 336 | struct nfs4_replay *rp = &open->op_openowner->oo_owner.so_replay; | 339 | struct nfs4_replay *rp = &open->op_openowner->oo_owner.so_replay; |
| 337 | fh_put(&cstate->current_fh); | 340 | fh_put(&cstate->current_fh); |
| @@ -354,10 +357,10 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 354 | /* Openowner is now set, so sequence id will get bumped. Now we need | 357 | /* Openowner is now set, so sequence id will get bumped. Now we need |
| 355 | * these checks before we do any creates: */ | 358 | * these checks before we do any creates: */ |
| 356 | status = nfserr_grace; | 359 | status = nfserr_grace; |
| 357 | if (locks_in_grace(SVC_NET(rqstp)) && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) | 360 | if (locks_in_grace(net) && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) |
| 358 | goto out; | 361 | goto out; |
| 359 | status = nfserr_no_grace; | 362 | status = nfserr_no_grace; |
| 360 | if (!locks_in_grace(SVC_NET(rqstp)) && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) | 363 | if (!locks_in_grace(net) && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) |
| 361 | goto out; | 364 | goto out; |
| 362 | 365 | ||
| 363 | switch (open->op_claim_type) { | 366 | switch (open->op_claim_type) { |
| @@ -370,7 +373,9 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 370 | break; | 373 | break; |
| 371 | case NFS4_OPEN_CLAIM_PREVIOUS: | 374 | case NFS4_OPEN_CLAIM_PREVIOUS: |
| 372 | open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; | 375 | open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED; |
| 373 | status = nfs4_check_open_reclaim(&open->op_clientid, cstate->minorversion); | 376 | status = nfs4_check_open_reclaim(&open->op_clientid, |
| 377 | cstate->minorversion, | ||
| 378 | nn); | ||
| 374 | if (status) | 379 | if (status) |
| 375 | goto out; | 380 | goto out; |
| 376 | case NFS4_OPEN_CLAIM_FH: | 381 | case NFS4_OPEN_CLAIM_FH: |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index a8e406449ef6..996a8a58944d 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
| @@ -2620,14 +2620,13 @@ static __be32 nfsd4_check_seqid(struct nfsd4_compound_state *cstate, struct nfs4 | |||
| 2620 | 2620 | ||
| 2621 | __be32 | 2621 | __be32 |
| 2622 | nfsd4_process_open1(struct nfsd4_compound_state *cstate, | 2622 | nfsd4_process_open1(struct nfsd4_compound_state *cstate, |
| 2623 | struct nfsd4_open *open) | 2623 | struct nfsd4_open *open, struct nfsd_net *nn) |
| 2624 | { | 2624 | { |
| 2625 | clientid_t *clientid = &open->op_clientid; | 2625 | clientid_t *clientid = &open->op_clientid; |
| 2626 | struct nfs4_client *clp = NULL; | 2626 | struct nfs4_client *clp = NULL; |
| 2627 | unsigned int strhashval; | 2627 | unsigned int strhashval; |
| 2628 | struct nfs4_openowner *oo = NULL; | 2628 | struct nfs4_openowner *oo = NULL; |
| 2629 | __be32 status; | 2629 | __be32 status; |
| 2630 | struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); | ||
| 2631 | 2630 | ||
| 2632 | if (STALE_CLIENTID(&open->op_clientid, nn)) | 2631 | if (STALE_CLIENTID(&open->op_clientid, nn)) |
| 2633 | return nfserr_stale_clientid; | 2632 | return nfserr_stale_clientid; |
| @@ -3408,10 +3407,11 @@ static __be32 nfsd4_validate_stateid(struct nfs4_client *cl, stateid_t *stateid) | |||
| 3408 | return nfs_ok; | 3407 | return nfs_ok; |
| 3409 | } | 3408 | } |
| 3410 | 3409 | ||
| 3411 | static __be32 nfsd4_lookup_stateid(stateid_t *stateid, unsigned char typemask, struct nfs4_stid **s, bool sessions) | 3410 | static __be32 nfsd4_lookup_stateid(stateid_t *stateid, unsigned char typemask, |
| 3411 | struct nfs4_stid **s, bool sessions, | ||
| 3412 | struct nfsd_net *nn) | ||
| 3412 | { | 3413 | { |
| 3413 | struct nfs4_client *cl; | 3414 | struct nfs4_client *cl; |
| 3414 | struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); | ||
| 3415 | 3415 | ||
| 3416 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) | 3416 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) |
| 3417 | return nfserr_bad_stateid; | 3417 | return nfserr_bad_stateid; |
| @@ -3439,6 +3439,7 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, | |||
| 3439 | struct nfs4_delegation *dp = NULL; | 3439 | struct nfs4_delegation *dp = NULL; |
| 3440 | struct svc_fh *current_fh = &cstate->current_fh; | 3440 | struct svc_fh *current_fh = &cstate->current_fh; |
| 3441 | struct inode *ino = current_fh->fh_dentry->d_inode; | 3441 | struct inode *ino = current_fh->fh_dentry->d_inode; |
| 3442 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
| 3442 | __be32 status; | 3443 | __be32 status; |
| 3443 | 3444 | ||
| 3444 | if (filpp) | 3445 | if (filpp) |
| @@ -3450,7 +3451,8 @@ nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, | |||
| 3450 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) | 3451 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) |
| 3451 | return check_special_stateids(net, current_fh, stateid, flags); | 3452 | return check_special_stateids(net, current_fh, stateid, flags); |
| 3452 | 3453 | ||
| 3453 | status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, &s, cstate->minorversion); | 3454 | status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, |
| 3455 | &s, cstate->minorversion, nn); | ||
| 3454 | if (status) | 3456 | if (status) |
| 3455 | return status; | 3457 | return status; |
| 3456 | status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate)); | 3458 | status = check_stateid_generation(stateid, &s->sc_stateid, nfsd4_has_session(cstate)); |
| @@ -3591,7 +3593,8 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ | |||
| 3591 | static __be32 | 3593 | static __be32 |
| 3592 | nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | 3594 | nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, |
| 3593 | stateid_t *stateid, char typemask, | 3595 | stateid_t *stateid, char typemask, |
| 3594 | struct nfs4_ol_stateid **stpp) | 3596 | struct nfs4_ol_stateid **stpp, |
| 3597 | struct nfsd_net *nn) | ||
| 3595 | { | 3598 | { |
| 3596 | __be32 status; | 3599 | __be32 status; |
| 3597 | struct nfs4_stid *s; | 3600 | struct nfs4_stid *s; |
| @@ -3600,7 +3603,8 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
| 3600 | seqid, STATEID_VAL(stateid)); | 3603 | seqid, STATEID_VAL(stateid)); |
| 3601 | 3604 | ||
| 3602 | *stpp = NULL; | 3605 | *stpp = NULL; |
| 3603 | status = nfsd4_lookup_stateid(stateid, typemask, &s, cstate->minorversion); | 3606 | status = nfsd4_lookup_stateid(stateid, typemask, &s, |
| 3607 | cstate->minorversion, nn); | ||
| 3604 | if (status) | 3608 | if (status) |
| 3605 | return status; | 3609 | return status; |
| 3606 | *stpp = openlockstateid(s); | 3610 | *stpp = openlockstateid(s); |
| @@ -3609,13 +3613,14 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
| 3609 | return nfs4_seqid_op_checks(cstate, stateid, seqid, *stpp); | 3613 | return nfs4_seqid_op_checks(cstate, stateid, seqid, *stpp); |
| 3610 | } | 3614 | } |
| 3611 | 3615 | ||
| 3612 | static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, stateid_t *stateid, struct nfs4_ol_stateid **stpp) | 3616 | static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, |
| 3617 | stateid_t *stateid, struct nfs4_ol_stateid **stpp, struct nfsd_net *nn) | ||
| 3613 | { | 3618 | { |
| 3614 | __be32 status; | 3619 | __be32 status; |
| 3615 | struct nfs4_openowner *oo; | 3620 | struct nfs4_openowner *oo; |
| 3616 | 3621 | ||
| 3617 | status = nfs4_preprocess_seqid_op(cstate, seqid, stateid, | 3622 | status = nfs4_preprocess_seqid_op(cstate, seqid, stateid, |
| 3618 | NFS4_OPEN_STID, stpp); | 3623 | NFS4_OPEN_STID, stpp, nn); |
| 3619 | if (status) | 3624 | if (status) |
| 3620 | return status; | 3625 | return status; |
| 3621 | oo = openowner((*stpp)->st_stateowner); | 3626 | oo = openowner((*stpp)->st_stateowner); |
| @@ -3631,6 +3636,7 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 3631 | __be32 status; | 3636 | __be32 status; |
| 3632 | struct nfs4_openowner *oo; | 3637 | struct nfs4_openowner *oo; |
| 3633 | struct nfs4_ol_stateid *stp; | 3638 | struct nfs4_ol_stateid *stp; |
| 3639 | struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); | ||
| 3634 | 3640 | ||
| 3635 | dprintk("NFSD: nfsd4_open_confirm on file %.*s\n", | 3641 | dprintk("NFSD: nfsd4_open_confirm on file %.*s\n", |
| 3636 | (int)cstate->current_fh.fh_dentry->d_name.len, | 3642 | (int)cstate->current_fh.fh_dentry->d_name.len, |
| @@ -3644,7 +3650,7 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 3644 | 3650 | ||
| 3645 | status = nfs4_preprocess_seqid_op(cstate, | 3651 | status = nfs4_preprocess_seqid_op(cstate, |
| 3646 | oc->oc_seqid, &oc->oc_req_stateid, | 3652 | oc->oc_seqid, &oc->oc_req_stateid, |
| 3647 | NFS4_OPEN_STID, &stp); | 3653 | NFS4_OPEN_STID, &stp, nn); |
| 3648 | if (status) | 3654 | if (status) |
| 3649 | goto out; | 3655 | goto out; |
| 3650 | oo = openowner(stp->st_stateowner); | 3656 | oo = openowner(stp->st_stateowner); |
| @@ -3708,6 +3714,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, | |||
| 3708 | { | 3714 | { |
| 3709 | __be32 status; | 3715 | __be32 status; |
| 3710 | struct nfs4_ol_stateid *stp; | 3716 | struct nfs4_ol_stateid *stp; |
| 3717 | struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); | ||
| 3711 | 3718 | ||
| 3712 | dprintk("NFSD: nfsd4_open_downgrade on file %.*s\n", | 3719 | dprintk("NFSD: nfsd4_open_downgrade on file %.*s\n", |
| 3713 | (int)cstate->current_fh.fh_dentry->d_name.len, | 3720 | (int)cstate->current_fh.fh_dentry->d_name.len, |
| @@ -3720,7 +3727,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, | |||
| 3720 | 3727 | ||
| 3721 | nfs4_lock_state(); | 3728 | nfs4_lock_state(); |
| 3722 | status = nfs4_preprocess_confirmed_seqid_op(cstate, od->od_seqid, | 3729 | status = nfs4_preprocess_confirmed_seqid_op(cstate, od->od_seqid, |
| 3723 | &od->od_stateid, &stp); | 3730 | &od->od_stateid, &stp, nn); |
| 3724 | if (status) | 3731 | if (status) |
| 3725 | goto out; | 3732 | goto out; |
| 3726 | status = nfserr_inval; | 3733 | status = nfserr_inval; |
| @@ -3783,6 +3790,8 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 3783 | __be32 status; | 3790 | __be32 status; |
| 3784 | struct nfs4_openowner *oo; | 3791 | struct nfs4_openowner *oo; |
| 3785 | struct nfs4_ol_stateid *stp; | 3792 | struct nfs4_ol_stateid *stp; |
| 3793 | struct net *net = SVC_NET(rqstp); | ||
| 3794 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
| 3786 | 3795 | ||
| 3787 | dprintk("NFSD: nfsd4_close on file %.*s\n", | 3796 | dprintk("NFSD: nfsd4_close on file %.*s\n", |
| 3788 | (int)cstate->current_fh.fh_dentry->d_name.len, | 3797 | (int)cstate->current_fh.fh_dentry->d_name.len, |
| @@ -3792,7 +3801,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 3792 | status = nfs4_preprocess_seqid_op(cstate, close->cl_seqid, | 3801 | status = nfs4_preprocess_seqid_op(cstate, close->cl_seqid, |
| 3793 | &close->cl_stateid, | 3802 | &close->cl_stateid, |
| 3794 | NFS4_OPEN_STID|NFS4_CLOSED_STID, | 3803 | NFS4_OPEN_STID|NFS4_CLOSED_STID, |
| 3795 | &stp); | 3804 | &stp, nn); |
| 3796 | if (status) | 3805 | if (status) |
| 3797 | goto out; | 3806 | goto out; |
| 3798 | oo = openowner(stp->st_stateowner); | 3807 | oo = openowner(stp->st_stateowner); |
| @@ -3831,12 +3840,14 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 3831 | stateid_t *stateid = &dr->dr_stateid; | 3840 | stateid_t *stateid = &dr->dr_stateid; |
| 3832 | struct nfs4_stid *s; | 3841 | struct nfs4_stid *s; |
| 3833 | __be32 status; | 3842 | __be32 status; |
| 3843 | struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); | ||
| 3834 | 3844 | ||
| 3835 | if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) | 3845 | if ((status = fh_verify(rqstp, &cstate->current_fh, S_IFREG, 0))) |
| 3836 | return status; | 3846 | return status; |
| 3837 | 3847 | ||
| 3838 | nfs4_lock_state(); | 3848 | nfs4_lock_state(); |
| 3839 | status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID, &s, cstate->minorversion); | 3849 | status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID, &s, |
| 3850 | cstate->minorversion, nn); | ||
| 3840 | if (status) | 3851 | if (status) |
| 3841 | goto out; | 3852 | goto out; |
| 3842 | dp = delegstateid(s); | 3853 | dp = delegstateid(s); |
| @@ -4085,7 +4096,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 4085 | bool new_state = false; | 4096 | bool new_state = false; |
| 4086 | int lkflg; | 4097 | int lkflg; |
| 4087 | int err; | 4098 | int err; |
| 4088 | struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); | 4099 | struct net *net = SVC_NET(rqstp); |
| 4100 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
| 4089 | 4101 | ||
| 4090 | dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n", | 4102 | dprintk("NFSD: nfsd4_lock: start=%Ld length=%Ld\n", |
| 4091 | (long long) lock->lk_offset, | 4103 | (long long) lock->lk_offset, |
| @@ -4119,7 +4131,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 4119 | status = nfs4_preprocess_confirmed_seqid_op(cstate, | 4131 | status = nfs4_preprocess_confirmed_seqid_op(cstate, |
| 4120 | lock->lk_new_open_seqid, | 4132 | lock->lk_new_open_seqid, |
| 4121 | &lock->lk_new_open_stateid, | 4133 | &lock->lk_new_open_stateid, |
| 4122 | &open_stp); | 4134 | &open_stp, nn); |
| 4123 | if (status) | 4135 | if (status) |
| 4124 | goto out; | 4136 | goto out; |
| 4125 | open_sop = openowner(open_stp->st_stateowner); | 4137 | open_sop = openowner(open_stp->st_stateowner); |
| @@ -4133,7 +4145,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 4133 | status = nfs4_preprocess_seqid_op(cstate, | 4145 | status = nfs4_preprocess_seqid_op(cstate, |
| 4134 | lock->lk_old_lock_seqid, | 4146 | lock->lk_old_lock_seqid, |
| 4135 | &lock->lk_old_lock_stateid, | 4147 | &lock->lk_old_lock_stateid, |
| 4136 | NFS4_LOCK_STID, &lock_stp); | 4148 | NFS4_LOCK_STID, &lock_stp, nn); |
| 4137 | if (status) | 4149 | if (status) |
| 4138 | goto out; | 4150 | goto out; |
| 4139 | lock_sop = lockowner(lock_stp->st_stateowner); | 4151 | lock_sop = lockowner(lock_stp->st_stateowner); |
| @@ -4144,10 +4156,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 4144 | goto out; | 4156 | goto out; |
| 4145 | 4157 | ||
| 4146 | status = nfserr_grace; | 4158 | status = nfserr_grace; |
| 4147 | if (locks_in_grace(SVC_NET(rqstp)) && !lock->lk_reclaim) | 4159 | if (locks_in_grace(net) && !lock->lk_reclaim) |
| 4148 | goto out; | 4160 | goto out; |
| 4149 | status = nfserr_no_grace; | 4161 | status = nfserr_no_grace; |
| 4150 | if (!locks_in_grace(SVC_NET(rqstp)) && lock->lk_reclaim) | 4162 | if (!locks_in_grace(net) && lock->lk_reclaim) |
| 4151 | goto out; | 4163 | goto out; |
| 4152 | 4164 | ||
| 4153 | file_lock = locks_alloc_lock(); | 4165 | file_lock = locks_alloc_lock(); |
| @@ -4333,7 +4345,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 4333 | struct file_lock *file_lock = NULL; | 4345 | struct file_lock *file_lock = NULL; |
| 4334 | __be32 status; | 4346 | __be32 status; |
| 4335 | int err; | 4347 | int err; |
| 4336 | 4348 | struct nfsd_net *nn = net_generic(SVC_NET(rqstp), nfsd_net_id); | |
| 4349 | |||
| 4337 | dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n", | 4350 | dprintk("NFSD: nfsd4_locku: start=%Ld length=%Ld\n", |
| 4338 | (long long) locku->lu_offset, | 4351 | (long long) locku->lu_offset, |
| 4339 | (long long) locku->lu_length); | 4352 | (long long) locku->lu_length); |
| @@ -4344,7 +4357,8 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
| 4344 | nfs4_lock_state(); | 4357 | nfs4_lock_state(); |
| 4345 | 4358 | ||
| 4346 | status = nfs4_preprocess_seqid_op(cstate, locku->lu_seqid, | 4359 | status = nfs4_preprocess_seqid_op(cstate, locku->lu_seqid, |
| 4347 | &locku->lu_stateid, NFS4_LOCK_STID, &stp); | 4360 | &locku->lu_stateid, NFS4_LOCK_STID, |
| 4361 | &stp, nn); | ||
| 4348 | if (status) | 4362 | if (status) |
| 4349 | goto out; | 4363 | goto out; |
| 4350 | filp = find_any_file(stp->st_file); | 4364 | filp = find_any_file(stp->st_file); |
| @@ -4564,10 +4578,9 @@ nfsd4_find_reclaim_client(const char *recdir, struct nfsd_net *nn) | |||
| 4564 | * Called from OPEN. Look for clientid in reclaim list. | 4578 | * Called from OPEN. Look for clientid in reclaim list. |
| 4565 | */ | 4579 | */ |
| 4566 | __be32 | 4580 | __be32 |
| 4567 | nfs4_check_open_reclaim(clientid_t *clid, bool sessions) | 4581 | nfs4_check_open_reclaim(clientid_t *clid, bool sessions, struct nfsd_net *nn) |
| 4568 | { | 4582 | { |
| 4569 | struct nfs4_client *clp; | 4583 | struct nfs4_client *clp; |
| 4570 | struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); | ||
| 4571 | 4584 | ||
| 4572 | /* find clientid in conf_id_hashtbl */ | 4585 | /* find clientid in conf_id_hashtbl */ |
| 4573 | clp = find_confirmed_client(clid, sessions, nn); | 4586 | clp = find_confirmed_client(clid, sessions, nn); |
| @@ -4583,7 +4596,7 @@ void nfsd_forget_clients(u64 num) | |||
| 4583 | { | 4596 | { |
| 4584 | struct nfs4_client *clp, *next; | 4597 | struct nfs4_client *clp, *next; |
| 4585 | int count = 0; | 4598 | int count = 0; |
| 4586 | struct nfsd_net *nn = net_generic(&init_net, nfsd_net_id); | 4599 | struct nfsd_net *nn = net_generic(current->nsproxy->net_ns, nfsd_net_id); |
| 4587 | 4600 | ||
| 4588 | nfs4_lock_state(); | 4601 | nfs4_lock_state(); |
| 4589 | list_for_each_entry_safe(clp, next, &nn->client_lru, cl_lru) { | 4602 | list_for_each_entry_safe(clp, next, &nn->client_lru, cl_lru) { |
| @@ -4897,8 +4910,8 @@ __nfs4_state_shutdown(struct net *net) | |||
| 4897 | unhash_delegation(dp); | 4910 | unhash_delegation(dp); |
| 4898 | } | 4911 | } |
| 4899 | 4912 | ||
| 4900 | nfsd4_client_tracking_exit(&init_net); | 4913 | nfsd4_client_tracking_exit(net); |
| 4901 | put_net(&init_net); | 4914 | put_net(net); |
| 4902 | } | 4915 | } |
| 4903 | 4916 | ||
| 4904 | void | 4917 | void |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 26a912cdfe0c..bfe0106333cc 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
| @@ -470,7 +470,7 @@ void nfs4_remove_reclaim_record(struct nfs4_client_reclaim *, struct nfsd_net *) | |||
| 470 | extern void nfs4_release_reclaim(struct nfsd_net *); | 470 | extern void nfs4_release_reclaim(struct nfsd_net *); |
| 471 | extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir, | 471 | extern struct nfs4_client_reclaim *nfsd4_find_reclaim_client(const char *recdir, |
| 472 | struct nfsd_net *nn); | 472 | struct nfsd_net *nn); |
| 473 | extern __be32 nfs4_check_open_reclaim(clientid_t *clid, bool sessions); | 473 | extern __be32 nfs4_check_open_reclaim(clientid_t *clid, bool sessions, struct nfsd_net *nn); |
| 474 | extern void nfs4_free_openowner(struct nfs4_openowner *); | 474 | extern void nfs4_free_openowner(struct nfs4_openowner *); |
| 475 | extern void nfs4_free_lockowner(struct nfs4_lockowner *); | 475 | extern void nfs4_free_lockowner(struct nfs4_lockowner *); |
| 476 | extern int set_callback_cred(void); | 476 | extern int set_callback_cred(void); |
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 71c5c47f2750..3c414c1be295 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h | |||
| @@ -581,7 +581,7 @@ extern __be32 nfsd4_destroy_session(struct svc_rqst *, | |||
| 581 | extern __be32 nfsd4_destroy_clientid(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_destroy_clientid *); | 581 | extern __be32 nfsd4_destroy_clientid(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_destroy_clientid *); |
| 582 | __be32 nfsd4_reclaim_complete(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_reclaim_complete *); | 582 | __be32 nfsd4_reclaim_complete(struct svc_rqst *, struct nfsd4_compound_state *, struct nfsd4_reclaim_complete *); |
| 583 | extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *, | 583 | extern __be32 nfsd4_process_open1(struct nfsd4_compound_state *, |
| 584 | struct nfsd4_open *open); | 584 | struct nfsd4_open *open, struct nfsd_net *nn); |
| 585 | extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, | 585 | extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, |
| 586 | struct svc_fh *current_fh, struct nfsd4_open *open); | 586 | struct svc_fh *current_fh, struct nfsd4_open *open); |
| 587 | extern void nfsd4_cleanup_open_state(struct nfsd4_open *open, __be32 status); | 587 | extern void nfsd4_cleanup_open_state(struct nfsd4_open *open, __be32 status); |
