Skip to content

Commit

Permalink
smb3: fix problem remounting a share after shutdown
Browse files Browse the repository at this point in the history
commit 716a3cf 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: 087f757 ("cifs: add shutdown support")
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Steve French authored and gregkh committed May 17, 2023
1 parent 145f54e commit bb0091a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -2742,6 +2742,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 */
Expand Down

0 comments on commit bb0091a

Please sign in to comment.