]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cifs: make sure that channel scaling is done only once
authorShyam Prasad N <sprasad@microsoft.com>
Mon, 29 Jan 2024 13:58:13 +0000 (13:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:34:51 +0000 (13:34 +0100)
commit567f1b1da5dad5d8001f13d4a55dcd8cff266d37
treeacda043c105c05454946f646aba925a8347fd06e
parente34e4e6d8c6953488e8613780dd529fe8d630852
cifs: make sure that channel scaling is done only once

[ Upstream commit ee36a3b345c433a846effcdcfba437c2298eeda5 ]

Following a successful cifs_tree_connect, we have the code
to scale up/down the number of channels in the session.
However, it is not protected by a lock today.

As a result, this code can be executed by several processes
that select the same channel. The core functions handle this
well, as they pick chan_lock. However, we've seen cases where
smb2_reconnect throws some warnings.

To fix that, this change introduces a flags bitmap inside the
cifs_ses structure. A new flag type is used to ensure that
only one process enters this section at any time.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/smb/client/cifsglob.h
fs/smb/client/smb2pdu.c