All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@cjr.nz>
To: linux-cifs@vger.kernel.org, smfrench@gmail.com
Cc: Paulo Alcantara <pc@cjr.nz>
Subject: [PATCH 4/7] cifs: handle empty list of targets in cifs_reconnect()
Date: Mon,  6 Jul 2020 12:23:59 -0300	[thread overview]
Message-ID: <20200706152402.5721-5-pc@cjr.nz> (raw)
In-Reply-To: <20200706152402.5721-1-pc@cjr.nz>

In case there were no cached DFS referrals in
reconn_setup_dfs_targets(), set cifs_sb to NULL prior to calling
reconn_set_next_dfs_target() so it would not try to access an empty
tgt_list.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
---
 fs/cifs/connect.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index b90ee86c0523..721ef2a53f65 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -470,11 +470,13 @@ cifs_reconnect(struct TCP_Server_Info *server)
 		sb = NULL;
 	} else {
 		cifs_sb = CIFS_SB(sb);
-
 		rc = reconn_setup_dfs_targets(cifs_sb, &tgt_list);
-		if (rc && (rc != -EOPNOTSUPP)) {
-			cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n",
-				 __func__);
+		if (rc) {
+			cifs_sb = NULL;
+			if (rc != -EOPNOTSUPP) {
+				cifs_server_dbg(VFS, "%s: no target servers for DFS failover\n",
+						__func__);
+			}
 		} else {
 			server->nr_targets = dfs_cache_get_nr_tgts(&tgt_list);
 		}
-- 
2.27.0


  parent reply	other threads:[~2020-07-06 15:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 15:23 [PATCH 0/7] DFS fixes Paulo Alcantara
2020-07-06 15:23 ` [PATCH 1/7] cifs: merge __{cifs,smb2}_reconnect[_tcon]() into cifs_tree_connect() Paulo Alcantara
2020-07-06 15:36   ` Stefan Metzmacher
2020-07-06 15:47     ` Paulo Alcantara
2020-07-06 16:45       ` Paulo Alcantara
2020-07-06 15:23 ` [PATCH 2/7] cifs: reduce number of referral requests in DFS link lookups Paulo Alcantara
2020-07-06 15:23 ` [PATCH 3/7] cifs: rename reconn_inval_dfs_target() Paulo Alcantara
2020-07-06 15:23 ` Paulo Alcantara [this message]
2020-07-06 15:24 ` [PATCH 5/7] cifs: handle RESP_GET_DFS_REFERRAL.PathConsumed in reconnect Paulo Alcantara
2020-07-06 15:24 ` [PATCH 6/7] cifs: only update prefix path of DFS links in cifs_tree_connect() Paulo Alcantara
2020-07-06 15:24 ` [PATCH 7/7] cifs: document and cleanup dfs mount Paulo Alcantara

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=20200706152402.5721-5-pc@cjr.nz \
    --to=pc@cjr.nz \
    --cc=linux-cifs@vger.kernel.org \
    --cc=smfrench@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.