Skip to content

Commit a214384

Browse files
author
Steve French
committed
cifs: fix reconnect with SMB1 UNIX Extensions
When mounting with the SMB1 Unix Extensions (e.g. mounts to Samba with vers=1.0), reconnects no longer reset the Unix Extensions (SetFSInfo SET_FILE_UNIX_BASIC) after tcon so most operations (e.g. stat, ls, open, statfs) will fail continuously with: "Operation not supported" if the connection ever resets (e.g. due to brief network disconnect) Cc: stable@vger.kernel.org Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 193cc89 commit a214384

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

fs/smb/client/connect.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3686,6 +3686,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
36863686
}
36873687
#endif
36883688

3689+
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
36893690
/*
36903691
* Issue a TREE_CONNECT request.
36913692
*/
@@ -3807,11 +3808,25 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
38073808
else
38083809
tcon->Flags = 0;
38093810
cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags);
3810-
}
38113811

3812+
/*
3813+
* reset_cifs_unix_caps calls QFSInfo which requires
3814+
* need_reconnect to be false, but we would not need to call
3815+
* reset_caps if this were not a reconnect case so must check
3816+
* need_reconnect flag here. The caller will also clear
3817+
* need_reconnect when tcon was successful but needed to be
3818+
* cleared earlier in the case of unix extensions reconnect
3819+
*/
3820+
if (tcon->need_reconnect && tcon->unix_ext) {
3821+
cifs_dbg(FYI, "resetting caps for %s\n", tcon->tree_name);
3822+
tcon->need_reconnect = false;
3823+
reset_cifs_unix_caps(xid, tcon, NULL, NULL);
3824+
}
3825+
}
38123826
cifs_buf_release(smb_buffer);
38133827
return rc;
38143828
}
3829+
#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
38153830

38163831
static void delayed_free(struct rcu_head *p)
38173832
{

0 commit comments

Comments
 (0)