Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@cjr.nz>
To: smfrench@gmail.com
Cc: linux-cifs@vger.kernel.org, Paulo Alcantara <pc@cjr.nz>
Subject: [PATCH] cifs: do not query ifaces on smb1 mounts
Date: Mon,  9 Jan 2023 13:41:46 -0300	[thread overview]
Message-ID: <20230109164146.1910-1-pc@cjr.nz> (raw)

Users have reported the following error on every 600 seconds
(SMB_INTERFACE_POLL_INTERVAL) when mounting SMB1 shares:

	CIFS: VFS: \\srv\share error -5 on ioctl to get interface list

It's supported only by SMB2+, so do not query network interfaces on
SMB1 mounts.

Fixes: 6e1c1c08cdf3 ("cifs: periodically query network interfaces from server")
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
---
 fs/cifs/cifsglob.h |  1 +
 fs/cifs/connect.c  | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index cfdd5bf701a1..931e9d5b21f4 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1240,6 +1240,7 @@ struct cifs_tcon {
 #ifdef CONFIG_CIFS_DFS_UPCALL
 	struct list_head ulist; /* cache update list */
 #endif
+	bool			iface_query_poll:1;
 	struct delayed_work	query_interfaces; /* query interfaces workqueue job */
 };
 
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index d371259d6808..164beb365bfe 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2366,7 +2366,10 @@ cifs_put_tcon(struct cifs_tcon *tcon)
 	spin_unlock(&cifs_tcp_ses_lock);
 
 	/* cancel polling of interfaces */
-	cancel_delayed_work_sync(&tcon->query_interfaces);
+	if (tcon->iface_query_poll) {
+		tcon->iface_query_poll = false;
+		cancel_delayed_work_sync(&tcon->query_interfaces);
+	}
 
 	if (tcon->use_witness) {
 		int rc;
@@ -2606,11 +2609,14 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx)
 	INIT_LIST_HEAD(&tcon->pending_opens);
 	tcon->status = TID_GOOD;
 
-	/* schedule query interfaces poll */
-	INIT_DELAYED_WORK(&tcon->query_interfaces,
-			  smb2_query_server_interfaces);
-	queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
-			   (SMB_INTERFACE_POLL_INTERVAL * HZ));
+	if (!is_smb1_server(ses->server)) {
+		/* schedule query interfaces poll */
+		tcon->iface_query_poll = true;
+		INIT_DELAYED_WORK(&tcon->query_interfaces,
+				  smb2_query_server_interfaces);
+		queue_delayed_work(cifsiod_wq, &tcon->query_interfaces,
+				   (SMB_INTERFACE_POLL_INTERVAL * HZ));
+	}
 
 	spin_lock(&cifs_tcp_ses_lock);
 	list_add(&tcon->tcon_list, &ses->tcon_list);
-- 
2.39.0


             reply	other threads:[~2023-01-09 16:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09 16:41 Paulo Alcantara [this message]
2023-01-10 14:57 ` [PATCH] cifs: do not query ifaces on smb1 mounts Tom Talpey
2023-01-10 16:45   ` Paulo Alcantara
2023-01-10 22:23 ` [PATCH v2] " Paulo Alcantara
2023-01-10 22:31   ` Steve French
2023-01-11  1:42   ` Tom Talpey
2023-01-11  2:24     ` Paulo Alcantara
2023-01-11  2:32       ` Tom Talpey

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=20230109164146.1910-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox