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)
committerSteve French <stfrench@microsoft.com>
Wed, 31 Jan 2024 22:52:03 +0000 (16:52 -0600)
commitee36a3b345c433a846effcdcfba437c2298eeda5
treef99497ee1999bc0b09b525b22bc78eb9adf979e9
parent41bccc98fb7931d63d03f326a746ac4d429c1dd3
cifs: make sure that channel scaling is done only once

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>
fs/smb/client/cifsglob.h
fs/smb/client/smb2pdu.c