Skip to content

Commit 4c64937

Browse files
J. Bruce FieldsJ. Bruce Fields
authored andcommitted
nfsd4: modify session list under cl_lock
We want to traverse this from the callback code. Signed-off-by: J. Bruce Fields <[email protected]>
1 parent ec26fba commit 4c64937

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/nfsd/nfs4state.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,9 @@ static struct nfsd4_session *alloc_init_session(struct svc_rqst *rqstp, struct n
771771
idx = hash_sessionid(&new->se_sessionid);
772772
spin_lock(&client_lock);
773773
list_add(&new->se_hash, &sessionid_hashtbl[idx]);
774+
spin_lock(&clp->cl_lock);
774775
list_add(&new->se_perclnt, &clp->cl_sessions);
776+
spin_unlock(&clp->cl_lock);
775777
spin_unlock(&client_lock);
776778

777779
status = nfsd4_new_conn(rqstp, new);
@@ -819,7 +821,9 @@ static void
819821
unhash_session(struct nfsd4_session *ses)
820822
{
821823
list_del(&ses->se_hash);
824+
spin_lock(&ses->se_client->cl_lock);
822825
list_del(&ses->se_perclnt);
826+
spin_unlock(&ses->se_client->cl_lock);
823827
}
824828

825829
/* must be called under the client_lock */
@@ -925,8 +929,10 @@ unhash_client_locked(struct nfs4_client *clp)
925929

926930
mark_client_expired(clp);
927931
list_del(&clp->cl_lru);
932+
spin_lock(&clp->cl_lock);
928933
list_for_each_entry(ses, &clp->cl_sessions, se_perclnt)
929934
list_del_init(&ses->se_hash);
935+
spin_unlock(&clp->cl_lock);
930936
}
931937

932938
static void

0 commit comments

Comments
 (0)