Skip to content

Commit

Permalink
nfsd4: fold release_session into expire_client
Browse files Browse the repository at this point in the history
and grab the client lock once for all the client's sessions.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
  • Loading branch information
Benny Halevy authored and J. Bruce Fields committed May 12, 2010
1 parent 9089f1b commit be1fdf6
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,15 +613,6 @@ unhash_session(struct nfsd4_session *ses)
list_del(&ses->se_perclnt);
}

static void
release_session(struct nfsd4_session *ses)
{
spin_lock(&client_lock);
unhash_session(ses);
spin_unlock(&client_lock);
nfsd4_put_session(ses);
}

void
free_session(struct kref *kref)
{
Expand Down Expand Up @@ -722,12 +713,15 @@ expire_client(struct nfs4_client *clp)
sop = list_entry(clp->cl_openowners.next, struct nfs4_stateowner, so_perclient);
release_openowner(sop);
}
spin_lock(&client_lock);
while (!list_empty(&clp->cl_sessions)) {
struct nfsd4_session *ses;
ses = list_entry(clp->cl_sessions.next, struct nfsd4_session,
se_perclnt);
release_session(ses);
unhash_session(ses);
nfsd4_put_session(ses);
}
spin_unlock(&client_lock);
nfsd4_set_callback_client(clp, NULL);
if (clp->cl_cb_conn.cb_xprt)
svc_xprt_put(clp->cl_cb_conn.cb_xprt);
Expand Down

0 comments on commit be1fdf6

Please sign in to comment.