]> git.itanic.dy.fi Git - linux-stable/commitdiff
smb3: fix problem remounting a share after shutdown
authorSteve French <stfrench@microsoft.com>
Tue, 9 May 2023 06:37:19 +0000 (01:37 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:50:23 +0000 (11:50 +0200)
commit 716a3cf317456fa01d54398bb14ab354f50ed6a2 upstream.

xfstests generic/392 showed a problem where even after a
shutdown call was made on a mount, we would still attempt
to use the (now inaccessible) superblock if another mount
was attempted for the same share.

Reported-by: David Howells <dhowells@redhat.com>
Reviewed-by: David Howells <dhowells@redhat.com>
Cc: <stable@vger.kernel.org>
Fixes: 087f757b0129 ("cifs: add shutdown support")
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/connect.c

index f6c41265fdfd9f9772362da491818cf4eaccbd95..a521c705b0d7afb082e816bd6609135e67d57410 100644 (file)
@@ -2474,6 +2474,13 @@ cifs_match_super(struct super_block *sb, void *data)
 
        spin_lock(&cifs_tcp_ses_lock);
        cifs_sb = CIFS_SB(sb);
+
+       /* We do not want to use a superblock that has been shutdown */
+       if (CIFS_MOUNT_SHUTDOWN & cifs_sb->mnt_cifs_flags) {
+               spin_unlock(&cifs_tcp_ses_lock);
+               return 0;
+       }
+
        tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb));
        if (tlink == NULL) {
                /* can not match superblock if tlink were ever null */