]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
cifs: do all necessary checks for credits within or before locking
authorShyam Prasad N <sprasad@microsoft.com>
Thu, 22 Jun 2023 18:16:04 +0000 (18:16 +0000)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:19:52 +0000 (17:19 +0200)
commitc7b23ad9e2cd8b5362a308a8ab91528d790bbc77
treef5a35555b157c55ec8a76b79e85717b90d9e0b5f
parent78197d1265af01934f7de335ef5fcccf604faea8
cifs: do all necessary checks for credits within or before locking

BugLink: https://bugs.launchpad.net/bugs/2034469
[ Upstream commit 326a8d04f147e2bf393f6f9cdb74126ee6900607 ]

All the server credits and in-flight info is protected by req_lock.
Once the req_lock is held, and we've determined that we have enough
credits to continue, this lock cannot be dropped till we've made the
changes to credits and in-flight count.

However, we used to drop the lock in order to avoid deadlock with
the recent srv_lock. This could cause the checks already made to be
invalidated.

Fixed it by moving the server status check to before locking req_lock.

Fixes: d7d7a66aacd6 ("cifs: avoid use of global locks for high contention data")
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/smb/client/smb2ops.c
fs/smb/client/transport.c