Skip to content

Commit 489f710

Browse files
sprasad-microsoftsmfrench
authored andcommitted
cifs: unlock chan_lock before calling cifs_put_tcp_session
While removing an smb session, we need to free up the tcp session for each channel for that session. We were doing this with chan_lock held. This results in a cyclic dependency with cifs_tcp_ses_lock. For now, unlock the chan_lock temporarily before calling cifs_put_tcp_session. This should not cause any problem for now, since we do not remove channels anywhere else. And this code segment will not be called by two threads. When we do implement the code for removing channels, we will need to execute proper ref counting here. Signed-off-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 483529f commit 489f710

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

fs/cifs/connect.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,13 +1831,9 @@ void cifs_put_smb_ses(struct cifs_ses *ses)
18311831
int i;
18321832

18331833
for (i = 1; i < chan_count; i++) {
1834-
/*
1835-
* note: for now, we're okay accessing ses->chans
1836-
* without chan_lock. But when chans can go away, we'll
1837-
* need to introduce ref counting to make sure that chan
1838-
* is not freed from under us.
1839-
*/
1834+
spin_unlock(&ses->chan_lock);
18401835
cifs_put_tcp_session(ses->chans[i].server, 0);
1836+
spin_lock(&ses->chan_lock);
18411837
ses->chans[i].server = NULL;
18421838
}
18431839
}

0 commit comments

Comments
 (0)