Skip to content

Commit 6fbdd5a

Browse files
Paulo Alcantarasmfrench
authored andcommitted
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) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 466611e commit 6fbdd5a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fs/cifs/dfs.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,20 +451,19 @@ static int tree_connect_dfs_target(const unsigned int xid, struct cifs_tcon *tco
451451
int rc;
452452
int num_links = 0;
453453
struct TCP_Server_Info *server = tcon->ses->server;
454+
char *old_fullpath = server->leaf_fullpath;
454455

455456
do {
456457
rc = __tree_connect_dfs_target(xid, tcon, cifs_sb, tree, islink, tl);
457458
if (!rc || rc != -EREMOTE)
458459
break;
459460
} while (rc = -ELOOP, ++num_links < MAX_NESTED_LINKS);
460461
/*
461-
* If we couldn't tree connect to any targets from last referral path, then retry from
462-
* original referral path.
462+
* If we couldn't tree connect to any targets from last referral path, then
463+
* retry it from newly resolved dfs referral.
463464
*/
464-
if (rc && server->current_fullpath != server->origin_fullpath) {
465-
server->current_fullpath = server->origin_fullpath;
465+
if (rc && server->leaf_fullpath != old_fullpath)
466466
cifs_signal_cifsd_for_reconnect(server, true);
467-
}
468467

469468
dfs_cache_free_tgts(tl);
470469
return rc;

0 commit comments

Comments
 (0)