cifs: reconnect worker should take reference on server struct unconditionally
authorShyam Prasad N <sprasad@microsoft.com>
Wed, 6 Dec 2023 16:37:38 +0000 (16:37 +0000)
committerSteve French <stfrench@microsoft.com>
Wed, 6 Dec 2023 17:04:23 +0000 (11:04 -0600)
commit04909192ada3285070f8ced0af7f07735478b364
tree51a35d576634ce1f7867ae76a1288fb606c6db73
parent823342524868168bf681f135d01b4ae10f5863ec
cifs: reconnect worker should take reference on server struct unconditionally

Reconnect worker currently assumes that the server struct
is alive and only takes reference on the server if it needs
to call smb2_reconnect.

With the new ability to disable channels based on whether the
server has multichannel disabled, this becomes a problem when
we need to disable established channels. While disabling the
channels and deallocating the server, there could be reconnect
work that could not be cancelled (because it started).

This change forces the reconnect worker to unconditionally
take a reference on the server when it runs.

Also, this change now allows smb2_reconnect to know if it was
called by the reconnect worker. Based on this, the cifs_put_tcp_session
can decide whether it can cancel the reconnect work synchronously or not.

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