Message ID | 20201130180257.31787-10-scabrero@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Witness protocol support for transparent failover | expand |
tentatively merged into cifs-2.6.git for-next, let me know if any changes need to be made to it. On Mon, Nov 30, 2020 at 12:05 PM Samuel Cabrero <scabrero@suse.de> wrote: > > 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 a298518bebb2..3af88711643b 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.2 >
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index a298518bebb2..3af88711643b 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);
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(-)