diff mbox series

[PATCH[SMB3,client] part 4 of 4 from the DFS/reconnect patch series

Message ID CAH2r5mue8Ucb2S_rVRMbmfUy-indv-E67+=Hd292uMDu_f_Jag@mail.gmail.com
State New
Headers show
Series [PATCH[SMB3,client] part 4 of 4 from the DFS/reconnect patch series | expand

Commit Message

Steve French Dec. 17, 2022, 4:17 p.m. UTC
Last four patches from the recent DFS/reconnect series from Paulo.
(The earlier send to the list bounced).
diff mbox series

Patch

From a7f3c15a21850ef36cf38f7e046c27963b727955 Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <pc@cjr.nz>
Date: Sat, 17 Dec 2022 00:46:11 -0300
Subject: [PATCH 13/14] cifs: optimize reconnect of nested links

There is no point going all the way back to the original dfs full path
if reconnect of tcon did not finish due a nested link found as newly
resolved target for the current referral.  So, just mark current
server for reconnect as we already set @current_fullpath to the new
dfs referral in update_server_fullpath().

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/dfs.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/cifs/dfs.c b/fs/cifs/dfs.c
index 5afabca654c1..b541e68378f6 100644
--- a/fs/cifs/dfs.c
+++ b/fs/cifs/dfs.c
@@ -451,6 +451,7 @@  static int tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tco
 	int rc;
 	int num_links = 0;
 	struct TCP_Server_Info *server = tcon->ses->server;
+	char *old_fullpath = server->leaf_fullpath;
 
 	do {
 		rc = __tree_connect_dfs_target(xid, tcon, cifs_sb, tree, islink, tl);
@@ -458,13 +459,11 @@  static int tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tco
 			break;
 	} while (rc = -ELOOP, ++num_links < MAX_NESTED_LINKS);
 	/*
-	 * If we couldn't tree connect to any targets from last referral path, then retry from
-	 * original referral path.
+	 * If we couldn't tree connect to any targets from last referral path, then
+	 * retry it from newly resolved dfs referral.
 	 */
-	if (rc && server->current_fullpath != server->origin_fullpath) {
-		server->current_fullpath = server->origin_fullpath;
+	if (rc && server->leaf_fullpath != old_fullpath)
 		cifs_signal_cifsd_for_reconnect(server, true);
-	}
 
 	dfs_cache_free_tgts(tl);
 	return rc;
-- 
2.34.1