diff options
author | Paulo Alcantara <pc@cjr.nz> | 2022-09-14 07:34:51 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2022-09-14 11:59:51 +0300 |
commit | 621a41ae0834cec9cab312d600d2b9de41dc6eac (patch) | |
tree | 3b7869aeb5852508c07517ff60af8d82963d1f1b | |
parent | bedc8f76b3539ac4f952114b316bcc2251e808ce (diff) | |
download | linux-621a41ae0834cec9cab312d600d2b9de41dc6eac.tar.xz |
cifs: add missing spinlock around tcon refcount
Add missing spinlock to protect updates on tcon refcount in
cifs_put_tcon().
Fixes: d7d7a66aacd6 ("cifs: avoid use of global locks for high contention data")
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r-- | fs/cifs/connect.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 0225f4c8adf0..7ae6f2c08153 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2345,7 +2345,9 @@ cifs_put_tcon(struct cifs_tcon *tcon) ses = tcon->ses; cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count); spin_lock(&cifs_tcp_ses_lock); + spin_lock(&tcon->tc_lock); if (--tcon->tc_count > 0) { + spin_unlock(&tcon->tc_lock); spin_unlock(&cifs_tcp_ses_lock); return; } @@ -2354,6 +2356,7 @@ cifs_put_tcon(struct cifs_tcon *tcon) WARN_ON(tcon->tc_count < 0); list_del_init(&tcon->tcon_list); + spin_unlock(&tcon->tc_lock); spin_unlock(&cifs_tcp_ses_lock); /* cancel polling of interfaces */ |