Skip to content

Commit cd70a3e

Browse files
Paulo AlcantaraSteve French
authored andcommitted
cifs: use correct lock type in cifs_reconnect()
TCP_Server_Info::origin_fullpath and TCP_Server_Info::leaf_fullpath are protected by refpath_lock mutex and not cifs_tcp_ses_lock spinlock. Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Cc: stable@vger.kernel.org Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 41f1008 commit cd70a3e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fs/cifs/connect.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,19 @@ int cifs_reconnect(struct TCP_Server_Info *server, bool mark_smb_session)
534534
{
535535
/* If tcp session is not an dfs connection, then reconnect to last target server */
536536
spin_lock(&cifs_tcp_ses_lock);
537-
if (!server->is_dfs_conn || !server->origin_fullpath || !server->leaf_fullpath) {
537+
if (!server->is_dfs_conn) {
538538
spin_unlock(&cifs_tcp_ses_lock);
539539
return __cifs_reconnect(server, mark_smb_session);
540540
}
541541
spin_unlock(&cifs_tcp_ses_lock);
542542

543+
mutex_lock(&server->refpath_lock);
544+
if (!server->origin_fullpath || !server->leaf_fullpath) {
545+
mutex_unlock(&server->refpath_lock);
546+
return __cifs_reconnect(server, mark_smb_session);
547+
}
548+
mutex_unlock(&server->refpath_lock);
549+
543550
return reconnect_dfs_server(server);
544551
}
545552
#else

0 commit comments

Comments
 (0)