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>, Aurelien Aptel <aaptel@suse.com>
Subject: [PATCH v3 4/7] cifs: handle empty list of targets in cifs_reconnect()
Date: Tue, 21 Jul 2020 09:36:41 -0300	[thread overview]
Message-ID: <20200721123644.14728-5-pc@cjr.nz> (raw)
In-Reply-To: <20200721123644.14728-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>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
---
 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 9582f63b8ebc..1f35d84ed118 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-21 12:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-21 12:36 [PATCH v3 0/7] DFS fixes Paulo Alcantara
2020-07-21 12:36 ` [PATCH v3 1/7] cifs: merge __{cifs,smb2}_reconnect[_tcon]() into cifs_tree_connect() Paulo Alcantara
2020-07-21 12:36 ` [PATCH v3 2/7] cifs: reduce number of referral requests in DFS link lookups Paulo Alcantara
2020-07-21 12:36 ` [PATCH v3 3/7] cifs: rename reconn_inval_dfs_target() Paulo Alcantara
2020-07-21 12:36 ` Paulo Alcantara [this message]
2020-07-21 12:36 ` [PATCH v3 5/7] cifs: handle RESP_GET_DFS_REFERRAL.PathConsumed in reconnect Paulo Alcantara
2020-07-21 12:36 ` [PATCH v3 6/7] cifs: only update prefix path of DFS links in cifs_tree_connect() Paulo Alcantara
2020-07-21 12:36 ` [PATCH v3 7/7] cifs: document and cleanup dfs mount Paulo Alcantara
2020-07-30 12:16 ` [PATCH v3 0/7] DFS fixes Aurélien Aptel
2020-07-30 21:34   ` Steve French

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=20200721123644.14728-5-pc@cjr.nz \
    --to=pc@cjr.nz \
    --cc=aaptel@suse.com \
    --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.