Blob Blame History Raw
From: Shyam Prasad N <sprasad@microsoft.com>
Date: Sun, 16 Jan 2022 11:19:36 +0000
Subject: [PATCH] cifs: fix the cifs_reconnect path for DFS
Git-commit: e154cb7b0ab961f9d785ed34c2d7128413e7083d
References: bsc#1190317
Patch-mainline: v5.17-rc1

Recently, the cifs_reconnect code was refactored into
two branches for regular vs dfs codepath. Some of my
recent changes were missing in the dfs path, namely the
code to enable periodic DNS query, and a missing lock.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Acked-by: Enzo Matsumiya <ematsumiya@suse.de>
---
 fs/cifs/connect.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -575,8 +575,10 @@ static int __cifs_reconnect(struct TCP_S
 		}
 	} while (server->tcpStatus == CifsNeedReconnect);
 
+	spin_lock(&cifs_tcp_ses_lock);
 	if (server->tcpStatus == CifsNeedNegotiate)
 		mod_delayed_work(cifsiod_wq, &server->echo, 0);
+	spin_unlock(&cifs_tcp_ses_lock);
 
 	wake_up(&server->response_q);
 	return rc;
@@ -686,6 +688,7 @@ static int reconnect_dfs_server(struct T
 			server->tcpStatus = CifsNeedNegotiate;
 		spin_unlock(&GlobalMid_Lock);
 		mutex_unlock(&server->srv_mutex);
+		mod_delayed_work(cifsiod_wq, &server->reconnect, 0);
 	} while (server->tcpStatus == CifsNeedReconnect);
 
 	if (target_hint)