cifs: reconnect work should have reference on server struct
authorShyam Prasad N <sprasad@microsoft.com>
Fri, 13 Oct 2023 11:43:09 +0000 (11:43 +0000)
committerSteve French <stfrench@microsoft.com>
Thu, 9 Nov 2023 16:25:32 +0000 (10:25 -0600)
commit19a4b9d6c372cab6a3b2c9a061a236136fe95274
tree26cd88d594bf7b33c64e58b7efd5837614cf0c65
parent9599d59eb8fc0c0fd9480c4f22901533d08965ee
cifs: reconnect work should have reference on server struct

The delayed work for reconnect takes server struct
as a parameter. But it does so without holding a ref
to it. Normally, this may not show a problem as
the reconnect work is only cancelled on umount.

However, since we now plan to support scaling down of
channels, and the scale down can happen from reconnect
work itself, we need to fix it.

This change takes a reference on the server struct
before it is passed to the delayed work. And drops
the reference in the delayed work itself. Or if
the delayed work is successfully cancelled, by the
process that cancels it.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/connect.c
fs/smb/client/smb2pdu.c