smb3: fix unusable share after force unmount failure
authorSteve French <stfrench@microsoft.com>
Thu, 23 Mar 2023 21:20:02 +0000 (16:20 -0500)
committerSteve French <stfrench@microsoft.com>
Thu, 1 Jun 2023 04:24:22 +0000 (23:24 -0500)
commit18e479f25eafc14bcd659dda39aba102861ad3b3
tree95a39edd5c6bbb1f7020ca56ddef605b14ef5324
parentac437bee26ef7e60c83777352a5f36b40c47be0f
smb3: fix unusable share after force unmount failure

If user does forced unmount ("umount -f") while files are still open
on the share (as was seen in a Kubernetes example running on SMB3.1.1
mount) then we were marking the share as "TID_EXITING" in umount_begin()
which caused all subsequent operations (except write) to fail ... but
unfortunately when umount_begin() is called we do not know yet that
there are open files or active references on the share that would prevent
unmount from succeeding.  Kubernetes had example when they were doing
umount -f when files were open which caused the share to become
unusable until the files were closed (and the umount retried).

Fix this so that TID_EXITING is not set until we are about to send
the tree disconnect (not at the beginning of forced umounts in
umount_begin) so that if "umount -f" fails (due to open files or
references) the mount is still usable.

Cc: stable@vger.kernel.org
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cifsfs.c
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/smb2pdu.c