From: Samuel Cabrero <scabrero@suse.de>
To: linux-cifs@vger.kernel.org
Cc: Samuel Cabrero <scabrero@suse.de>
Subject: [PATCH v3 09/11] cifs: Simplify reconnect code when dfs upcall is enabled
Date: Fri, 30 Oct 2020 12:52:08 +0100 [thread overview]
Message-ID: <20201030115210.8888-10-scabrero@suse.de> (raw)
In-Reply-To: <20201030115210.8888-1-scabrero@suse.de>
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: Samuel Cabrero <scabrero@suse.de>
---
fs/cifs/connect.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index cb9ca4238ae9..14bbec0aeccf 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -296,7 +296,7 @@ static void cifs_prune_tlinks(struct work_struct *work);
* This should be called with server->srv_mutex held.
*/
#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 len;
@@ -331,14 +331,7 @@ static int reconn_set_ipaddr(struct TCP_Server_Info *server)
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 */
static void reconn_set_next_dfs_target(struct TCP_Server_Info *server,
struct cifs_sb_info *cifs_sb,
@@ -346,6 +339,7 @@ static void reconn_set_next_dfs_target(struct TCP_Server_Info *server,
struct dfs_cache_tgt_iterator **tgt_it)
{
const char *name;
+ int rc;
if (!cifs_sb || !cifs_sb->origin_fullpath)
return;
@@ -370,6 +364,12 @@ static void reconn_set_next_dfs_target(struct TCP_Server_Info *server,
"%s: failed to extract hostname from target: %ld\n",
__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,
@@ -528,11 +528,6 @@ cifs_reconnect(struct TCP_Server_Info *server)
*/
reconn_set_next_dfs_target(server, cifs_sb, &tgt_list, &tgt_it);
#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))
rc = smbd_reconnect(server);
--
2.29.0
next prev parent reply other threads:[~2020-10-30 11:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 11:51 [PATCH v3 00/11] Witness protocol support for transparent failover Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 01/11] cifs: Make extract_hostname function public Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 02/11] cifs: Make extract_sharename " Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 03/11] cifs: Register generic netlink family Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 04/11] cifs: add witness mount option and data structs Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 05/11] cifs: Send witness register and unregister commands to userspace daemon Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 06/11] cifs: Set witness notification handler for messages from " Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 07/11] cifs: Add witness information to debug data dump Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 08/11] cifs: Send witness register messages to userspace daemon in echo task Samuel Cabrero
2020-10-30 11:52 ` Samuel Cabrero [this message]
2020-10-30 11:52 ` [PATCH v3 10/11] cifs: Handle witness client move notification Samuel Cabrero
2020-10-30 11:52 ` [PATCH v3 11/11] cifs: Handle witness share moved notification Samuel Cabrero
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201030115210.8888-10-scabrero@suse.de \
--to=scabrero@suse.de \
--cc=linux-cifs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox