Skip to content

Commit 621a41a

Browse files
Paulo Alcantarasmfrench
authored andcommitted
cifs: add missing spinlock around tcon refcount
Add missing spinlock to protect updates on tcon refcount in cifs_put_tcon(). Fixes: d7d7a66 ("cifs: avoid use of global locks for high contention data") Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Reviewed-by: Ronnie Sahlberg <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent bedc8f7 commit 621a41a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/cifs/connect.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,7 +2345,9 @@ cifs_put_tcon(struct cifs_tcon *tcon)
23452345
ses = tcon->ses;
23462346
cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count);
23472347
spin_lock(&cifs_tcp_ses_lock);
2348+
spin_lock(&tcon->tc_lock);
23482349
if (--tcon->tc_count > 0) {
2350+
spin_unlock(&tcon->tc_lock);
23492351
spin_unlock(&cifs_tcp_ses_lock);
23502352
return;
23512353
}
@@ -2354,6 +2356,7 @@ cifs_put_tcon(struct cifs_tcon *tcon)
23542356
WARN_ON(tcon->tc_count < 0);
23552357

23562358
list_del_init(&tcon->tcon_list);
2359+
spin_unlock(&tcon->tc_lock);
23572360
spin_unlock(&cifs_tcp_ses_lock);
23582361

23592362
/* cancel polling of interfaces */

0 commit comments

Comments
 (0)