]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cifs: do not search for channel if server is terminating
authorShyam Prasad N <sprasad@microsoft.com>
Thu, 1 Feb 2024 11:15:28 +0000 (11:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2024 12:34:52 +0000 (13:34 +0100)
commit2b1f28ee49dad6d45bb7d8ab4b492570f7aeaa77
tree40b0db2940c4baa4f4bca930d64b016c76a184cb
parentfad689fce093d128a88eec2f7ab8643b0223d342
cifs: do not search for channel if server is terminating

[ Upstream commit 88675b22d34e6e815ad4bde09c590ccb2d50c59d ]

In order to scale down the channels, the following sequence
of operations happen:
1. server struct is marked for terminate
2. the channel is deallocated in the ses->chans array
3. at a later point the cifsd thread actually terminates the server

Between 2 and 3, there can be calls to find the channel for
a server struct. When that happens, there can be an ugly warning
that's logged. But this is expected.

So this change does two things:
1. in cifs_ses_get_chan_index, if server->terminate is set, return
2. always make sure server->terminate is set with chan_lock held

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