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>

+16 -1
+16 -1
fs/smb/client/connect.c
··· 3686 3686 } 3687 3687 #endif 3688 3688 3689 + #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY 3689 3690 /* 3690 3691 * Issue a TREE_CONNECT request. 3691 3692 */ ··· 3808 3807 else 3809 3808 tcon->Flags = 0; 3810 3809 cifs_dbg(FYI, "Tcon flags: 0x%x\n", tcon->Flags); 3811 - } 3812 3810 3811 + /* 3812 + * reset_cifs_unix_caps calls QFSInfo which requires 3813 + * need_reconnect to be false, but we would not need to call 3814 + * reset_caps if this were not a reconnect case so must check 3815 + * need_reconnect flag here. The caller will also clear 3816 + * need_reconnect when tcon was successful but needed to be 3817 + * cleared earlier in the case of unix extensions reconnect 3818 + */ 3819 + if (tcon->need_reconnect && tcon->unix_ext) { 3820 + cifs_dbg(FYI, "resetting caps for %s\n", tcon->tree_name); 3821 + tcon->need_reconnect = false; 3822 + reset_cifs_unix_caps(xid, tcon, NULL, NULL); 3823 + } 3824 + } 3813 3825 cifs_buf_release(smb_buffer); 3814 3826 return rc; 3815 3827 } 3828 + #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ 3816 3829 3817 3830 static void delayed_free(struct rcu_head *p) 3818 3831 {