diff options
author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-07-25 08:57:22 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-07-27 16:49:22 -0400 |
commit | 5ccb0066f2d561549cc4d73d7f56b4ce3ca7a8a1 (patch) | |
tree | 43ca9eff5c94fc3609d858ce2a430c544fcc5f99 /fs/nfsd/nfs4state.c | |
parent | db9c4553412d72c6a05e0168d1d487f66e0660b3 (diff) |
LockD: pass actual network namespace to grace period management functions
Passed network namespace replaced hard-coded init_net
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 4a44b50c2f58..34f65f10fa43 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -2885,7 +2885,8 @@ static void nfsd4_open_deleg_none_ext(struct nfsd4_open *open, int status) | |||
2885 | * Attempt to hand out a delegation. | 2885 | * Attempt to hand out a delegation. |
2886 | */ | 2886 | */ |
2887 | static void | 2887 | static void |
2888 | nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_ol_stateid *stp) | 2888 | nfs4_open_delegation(struct net *net, struct svc_fh *fh, |
2889 | struct nfsd4_open *open, struct nfs4_ol_stateid *stp) | ||
2889 | { | 2890 | { |
2890 | struct nfs4_delegation *dp; | 2891 | struct nfs4_delegation *dp; |
2891 | struct nfs4_openowner *oo = container_of(stp->st_stateowner, struct nfs4_openowner, oo_owner); | 2892 | struct nfs4_openowner *oo = container_of(stp->st_stateowner, struct nfs4_openowner, oo_owner); |
@@ -2906,7 +2907,7 @@ nfs4_open_delegation(struct svc_fh *fh, struct nfsd4_open *open, struct nfs4_ol_ | |||
2906 | case NFS4_OPEN_CLAIM_NULL: | 2907 | case NFS4_OPEN_CLAIM_NULL: |
2907 | /* Let's not give out any delegations till everyone's | 2908 | /* Let's not give out any delegations till everyone's |
2908 | * had the chance to reclaim theirs.... */ | 2909 | * had the chance to reclaim theirs.... */ |
2909 | if (locks_in_grace()) | 2910 | if (locks_in_grace(net)) |
2910 | goto out; | 2911 | goto out; |
2911 | if (!cb_up || !(oo->oo_flags & NFS4_OO_CONFIRMED)) | 2912 | if (!cb_up || !(oo->oo_flags & NFS4_OO_CONFIRMED)) |
2912 | goto out; | 2913 | goto out; |
@@ -3040,7 +3041,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
3040 | * Attempt to hand out a delegation. No error return, because the | 3041 | * Attempt to hand out a delegation. No error return, because the |
3041 | * OPEN succeeds even if we fail. | 3042 | * OPEN succeeds even if we fail. |
3042 | */ | 3043 | */ |
3043 | nfs4_open_delegation(current_fh, open, stp); | 3044 | nfs4_open_delegation(SVC_NET(rqstp), current_fh, open, stp); |
3044 | nodeleg: | 3045 | nodeleg: |
3045 | status = nfs_ok; | 3046 | status = nfs_ok; |
3046 | 3047 | ||
@@ -3279,11 +3280,11 @@ out: | |||
3279 | } | 3280 | } |
3280 | 3281 | ||
3281 | static inline __be32 | 3282 | static inline __be32 |
3282 | check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags) | 3283 | check_special_stateids(struct net *net, svc_fh *current_fh, stateid_t *stateid, int flags) |
3283 | { | 3284 | { |
3284 | if (ONE_STATEID(stateid) && (flags & RD_STATE)) | 3285 | if (ONE_STATEID(stateid) && (flags & RD_STATE)) |
3285 | return nfs_ok; | 3286 | return nfs_ok; |
3286 | else if (locks_in_grace()) { | 3287 | else if (locks_in_grace(net)) { |
3287 | /* Answer in remaining cases depends on existence of | 3288 | /* Answer in remaining cases depends on existence of |
3288 | * conflicting state; so we must wait out the grace period. */ | 3289 | * conflicting state; so we must wait out the grace period. */ |
3289 | return nfserr_grace; | 3290 | return nfserr_grace; |
@@ -3300,9 +3301,9 @@ check_special_stateids(svc_fh *current_fh, stateid_t *stateid, int flags) | |||
3300 | * that are not able to provide mandatory locking. | 3301 | * that are not able to provide mandatory locking. |
3301 | */ | 3302 | */ |
3302 | static inline int | 3303 | static inline int |
3303 | grace_disallows_io(struct inode *inode) | 3304 | grace_disallows_io(struct net *net, struct inode *inode) |
3304 | { | 3305 | { |
3305 | return locks_in_grace() && mandatory_lock(inode); | 3306 | return locks_in_grace(net) && mandatory_lock(inode); |
3306 | } | 3307 | } |
3307 | 3308 | ||
3308 | /* Returns true iff a is later than b: */ | 3309 | /* Returns true iff a is later than b: */ |
@@ -3393,7 +3394,7 @@ static __be32 nfsd4_lookup_stateid(stateid_t *stateid, unsigned char typemask, s | |||
3393 | * Checks for stateid operations | 3394 | * Checks for stateid operations |
3394 | */ | 3395 | */ |
3395 | __be32 | 3396 | __be32 |
3396 | nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | 3397 | nfs4_preprocess_stateid_op(struct net *net, struct nfsd4_compound_state *cstate, |
3397 | stateid_t *stateid, int flags, struct file **filpp) | 3398 | stateid_t *stateid, int flags, struct file **filpp) |
3398 | { | 3399 | { |
3399 | struct nfs4_stid *s; | 3400 | struct nfs4_stid *s; |
@@ -3406,11 +3407,11 @@ nfs4_preprocess_stateid_op(struct nfsd4_compound_state *cstate, | |||
3406 | if (filpp) | 3407 | if (filpp) |
3407 | *filpp = NULL; | 3408 | *filpp = NULL; |
3408 | 3409 | ||
3409 | if (grace_disallows_io(ino)) | 3410 | if (grace_disallows_io(net, ino)) |
3410 | return nfserr_grace; | 3411 | return nfserr_grace; |
3411 | 3412 | ||
3412 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) | 3413 | if (ZERO_STATEID(stateid) || ONE_STATEID(stateid)) |
3413 | return check_special_stateids(current_fh, stateid, flags); | 3414 | return check_special_stateids(net, current_fh, stateid, flags); |
3414 | 3415 | ||
3415 | status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, &s); | 3416 | status = nfsd4_lookup_stateid(stateid, NFS4_DELEG_STID|NFS4_OPEN_STID|NFS4_LOCK_STID, &s); |
3416 | if (status) | 3417 | if (status) |
@@ -4107,10 +4108,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
4107 | goto out; | 4108 | goto out; |
4108 | 4109 | ||
4109 | status = nfserr_grace; | 4110 | status = nfserr_grace; |
4110 | if (locks_in_grace() && !lock->lk_reclaim) | 4111 | if (locks_in_grace(SVC_NET(rqstp)) && !lock->lk_reclaim) |
4111 | goto out; | 4112 | goto out; |
4112 | status = nfserr_no_grace; | 4113 | status = nfserr_no_grace; |
4113 | if (!locks_in_grace() && lock->lk_reclaim) | 4114 | if (!locks_in_grace(SVC_NET(rqstp)) && lock->lk_reclaim) |
4114 | goto out; | 4115 | goto out; |
4115 | 4116 | ||
4116 | locks_init_lock(&file_lock); | 4117 | locks_init_lock(&file_lock); |
@@ -4210,7 +4211,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
4210 | struct nfs4_lockowner *lo; | 4211 | struct nfs4_lockowner *lo; |
4211 | __be32 status; | 4212 | __be32 status; |
4212 | 4213 | ||
4213 | if (locks_in_grace()) | 4214 | if (locks_in_grace(SVC_NET(rqstp))) |
4214 | return nfserr_grace; | 4215 | return nfserr_grace; |
4215 | 4216 | ||
4216 | if (check_lock_length(lockt->lt_offset, lockt->lt_length)) | 4217 | if (check_lock_length(lockt->lt_offset, lockt->lt_length)) |
@@ -4703,7 +4704,7 @@ nfs4_state_start(void) | |||
4703 | get_net(net); | 4704 | get_net(net); |
4704 | nfsd4_client_tracking_init(net); | 4705 | nfsd4_client_tracking_init(net); |
4705 | boot_time = get_seconds(); | 4706 | boot_time = get_seconds(); |
4706 | locks_start_grace(&nn->nfsd4_manager); | 4707 | locks_start_grace(net, &nn->nfsd4_manager); |
4707 | grace_ended = false; | 4708 | grace_ended = false; |
4708 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", | 4709 | printk(KERN_INFO "NFSD: starting %ld-second grace period\n", |
4709 | nfsd4_grace); | 4710 | nfsd4_grace); |