aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-06-30 11:48:37 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-07-08 17:14:36 -0400
commitacf9295b1c4e60fc205e21b7a5c9dc6e1cb2764a (patch)
tree7cdb5035f78c7a199f8694cd27c8e1aafa7416c4 /fs/nfsd/nfs4state.c
parentdb24b3b4b2a510ad0face05aec1c5bfbe89050bb (diff)
nfsd: clean up nfsd4_close_open_stateid
Minor cleanup that should introduce no behavioral changes. Currently this function just unhashes the stateid and leaves the caller to do the work of the CLOSE processing. Change nfsd4_close_open_stateid so that it handles doing all of the work of closing a stateid. Move the handling of the unhashed stateid into it instead of doing that work in nfsd4_close. This will help isolate some coming changes to stateid handling from nfsd4_close. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 106db71e0eef..1e973f67999d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4129,8 +4129,25 @@ out:
4129 4129
4130static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s) 4130static void nfsd4_close_open_stateid(struct nfs4_ol_stateid *s)
4131{ 4131{
4132 unhash_open_stateid(s); 4132 struct nfs4_client *clp = s->st_stid.sc_client;
4133 struct nfs4_openowner *oo = openowner(s->st_stateowner);
4134
4133 s->st_stid.sc_type = NFS4_CLOSED_STID; 4135 s->st_stid.sc_type = NFS4_CLOSED_STID;
4136 unhash_open_stateid(s);
4137
4138 if (clp->cl_minorversion) {
4139 free_generic_stateid(s);
4140 if (list_empty(&oo->oo_owner.so_stateids))
4141 release_openowner(oo);
4142 } else {
4143 oo->oo_last_closed_stid = s;
4144 /*
4145 * In the 4.0 case we need to keep the owners around a
4146 * little while to handle CLOSE replay.
4147 */
4148 if (list_empty(&oo->oo_owner.so_stateids))
4149 move_to_close_lru(oo, clp->net);
4150 }
4134} 4151}
4135 4152
4136/* 4153/*
@@ -4141,7 +4158,6 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4141 struct nfsd4_close *close) 4158 struct nfsd4_close *close)
4142{ 4159{
4143 __be32 status; 4160 __be32 status;
4144 struct nfs4_openowner *oo;
4145 struct nfs4_ol_stateid *stp; 4161 struct nfs4_ol_stateid *stp;
4146 struct net *net = SVC_NET(rqstp); 4162 struct net *net = SVC_NET(rqstp);
4147 struct nfsd_net *nn = net_generic(net, nfsd_net_id); 4163 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
@@ -4157,28 +4173,10 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4157 nfsd4_bump_seqid(cstate, status); 4173 nfsd4_bump_seqid(cstate, status);
4158 if (status) 4174 if (status)
4159 goto out; 4175 goto out;
4160 oo = openowner(stp->st_stateowner);
4161 update_stateid(&stp->st_stid.sc_stateid); 4176 update_stateid(&stp->st_stid.sc_stateid);
4162 memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t)); 4177 memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
4163 4178
4164 nfsd4_close_open_stateid(stp); 4179 nfsd4_close_open_stateid(stp);
4165
4166 if (cstate->minorversion)
4167 free_generic_stateid(stp);
4168 else
4169 oo->oo_last_closed_stid = stp;
4170
4171 if (list_empty(&oo->oo_owner.so_stateids)) {
4172 if (cstate->minorversion)
4173 release_openowner(oo);
4174 else {
4175 /*
4176 * In the 4.0 case we need to keep the owners around a
4177 * little while to handle CLOSE replay.
4178 */
4179 move_to_close_lru(oo, SVC_NET(rqstp));
4180 }
4181 }
4182out: 4180out:
4183 if (!cstate->replay_owner) 4181 if (!cstate->replay_owner)
4184 nfs4_unlock_state(); 4182 nfs4_unlock_state();