[SRU][P:linux-azure][PATCH v3 3/8] cifs: dns resolution is needed only for primary channel

Vinicius Peixoto vinicius.peixoto at canonical.com
Thu Jul 31 05:08:29 UTC 2025


From: Shyam Prasad N <sprasad at microsoft.com>

BugLink: https://bugs.launchpad.net/bugs/2118807

When calling cifs_reconnect, before the connection to the
server is reestablished, the code today does a DNS resolution and
updates server->dstaddr.

However, this is not necessary for secondary channels. Secondary
channels use the interface list returned by the server to decide
which address to connect to. And that happens after tcon is reconnected
and server interfaces are requested.

Signed-off-by: Shyam Prasad N <sprasad at microsoft.com>
Cc: stable at vger.kernel.org
Signed-off-by: Steve French <stfrench at microsoft.com>
(cherry picked from commit b4f60a053a2534c3e510ba0c1f8727566adf8317)
Signed-off-by: Vinicius Peixoto <vinicius.peixoto at canonical.com>
---
 fs/smb/client/connect.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 690682dc5ebc..7bb73d224877 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -392,7 +392,8 @@ static int __cifs_reconnect(struct TCP_Server_Info *server,
 		try_to_freeze();
 		cifs_server_lock(server);
 
-		if (!cifs_swn_set_server_dstaddr(server)) {
+		if (!cifs_swn_set_server_dstaddr(server) &&
+		    !SERVER_IS_CHAN(server)) {
 			/* resolve the hostname again to make sure that IP address is up-to-date */
 			rc = reconn_set_ipaddr_from_hostname(server);
 			cifs_dbg(FYI, "%s: reconn_set_ipaddr_from_hostname: rc=%d\n", __func__, rc);
-- 
2.45.2




More information about the kernel-team mailing list