Commit 7d6535b7 authored by Samuel Cabrero's avatar Samuel Cabrero Committed by Steve French

cifs: Simplify reconnect code when dfs upcall is enabled

Some witness notifications, like client move, tell the client to
reconnect to a specific IP address. In this situation the DFS failover
code path has to be skipped so clean up as much as possible the
cifs_reconnect() code.
Signed-off-by: default avatarSamuel Cabrero <scabrero@suse.de>
Reviewed-by: default avatarAurelien Aptel <aaptel@suse.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 21077c62
...@@ -88,7 +88,7 @@ static void cifs_prune_tlinks(struct work_struct *work); ...@@ -88,7 +88,7 @@ static void cifs_prune_tlinks(struct work_struct *work);
* This should be called with server->srv_mutex held. * This should be called with server->srv_mutex held.
*/ */
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
static int reconn_set_ipaddr(struct TCP_Server_Info *server) static int reconn_set_ipaddr_from_hostname(struct TCP_Server_Info *server)
{ {
int rc; int rc;
int len; int len;
...@@ -123,14 +123,7 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server) ...@@ -123,14 +123,7 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server)
return !rc ? -1 : 0; return !rc ? -1 : 0;
} }
#else
static inline int reconn_set_ipaddr(struct TCP_Server_Info *server)
{
return 0;
}
#endif
#ifdef CONFIG_CIFS_DFS_UPCALL
/* These functions must be called with server->srv_mutex held */ /* These functions must be called with server->srv_mutex held */
static void reconn_set_next_dfs_target(struct TCP_Server_Info *server, static void reconn_set_next_dfs_target(struct TCP_Server_Info *server,
struct cifs_sb_info *cifs_sb, struct cifs_sb_info *cifs_sb,
...@@ -138,6 +131,7 @@ static void reconn_set_next_dfs_target(struct TCP_Server_Info *server, ...@@ -138,6 +131,7 @@ static void reconn_set_next_dfs_target(struct TCP_Server_Info *server,
struct dfs_cache_tgt_iterator **tgt_it) struct dfs_cache_tgt_iterator **tgt_it)
{ {
const char *name; const char *name;
int rc;
if (!cifs_sb || !cifs_sb->origin_fullpath) if (!cifs_sb || !cifs_sb->origin_fullpath)
return; return;
...@@ -162,6 +156,12 @@ static void reconn_set_next_dfs_target(struct TCP_Server_Info *server, ...@@ -162,6 +156,12 @@ static void reconn_set_next_dfs_target(struct TCP_Server_Info *server,
"%s: failed to extract hostname from target: %ld\n", "%s: failed to extract hostname from target: %ld\n",
__func__, PTR_ERR(server->hostname)); __func__, PTR_ERR(server->hostname));
} }
rc = reconn_set_ipaddr_from_hostname(server);
if (rc) {
cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n",
__func__, rc);
}
} }
static inline int reconn_setup_dfs_targets(struct cifs_sb_info *cifs_sb, static inline int reconn_setup_dfs_targets(struct cifs_sb_info *cifs_sb,
...@@ -320,11 +320,6 @@ cifs_reconnect(struct TCP_Server_Info *server) ...@@ -320,11 +320,6 @@ cifs_reconnect(struct TCP_Server_Info *server)
*/ */
reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it); reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it);
#endif #endif
rc = reconn_set_ipaddr(server);
if (rc) {
cifs_dbg(FYI, "%s: failed to resolve hostname: %d\n",
__func__, rc);
}
if (cifs_rdma_enabled(server)) if (cifs_rdma_enabled(server))
rc = smbd_reconnect(server); rc = smbd_reconnect(server);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment