From 080dc5e5656c1cc1cdefb501b9b645a07519f763 Mon Sep 17 00:00:00 2001 From: Shyam Prasad N Date: Mon, 19 Jul 2021 17:05:53 +0000 Subject: cifs: take cifs_tcp_ses_lock for status checks While checking/updating status for tcp ses, smb ses or tcon, we take GlobalMid_Lock. This doesn't make any sense. Replaced it with cifs_tcp_ses_lock. Ideally, we should take a spin lock per struct. But since tcp ses, smb ses and tcon objects won't add up to a lot, I think there should not be too much contention. Also, in few other places, these are checked without locking. Added locking for these. Signed-off-by: Shyam Prasad N Signed-off-by: Steve French --- fs/cifs/sess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fs/cifs/sess.c') diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 61fc8cb1ec8f..03ba30843950 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -369,10 +369,10 @@ void cifs_ses_mark_for_reconnect(struct cifs_ses *ses) int i; for (i = 0; i < ses->chan_count; i++) { - spin_lock(&GlobalMid_Lock); + spin_lock(&cifs_tcp_ses_lock); if (ses->chans[i].server->tcpStatus != CifsExiting) ses->chans[i].server->tcpStatus = CifsNeedReconnect; - spin_unlock(&GlobalMid_Lock); + spin_unlock(&cifs_tcp_ses_lock); } } @@ -1052,9 +1052,9 @@ sess_establish_session(struct sess_data *sess_data) spin_unlock(&ses->chan_lock); /* Even if one channel is active, session is in good state */ - spin_lock(&GlobalMid_Lock); + spin_lock(&cifs_tcp_ses_lock); ses->status = CifsGood; - spin_unlock(&GlobalMid_Lock); + spin_unlock(&cifs_tcp_ses_lock); return 0; } -- cgit v1.2.3