cifs: do not query ifaces on smb1 mounts
Subsystems (2)
PATCH 1/1 cifs: do not query ifaces on smb1 mounts
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.
--- fs/cifs/cifsglob.h | 1 + fs/cifs/connect.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-)
fs/cifs/cifsglob.h +1 -0
@@ -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 */ };
fs/cifs/connect.c +12 -6
@@ -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);
Signature · 1 line
2.39.0
Tom Talpey
reviewerQuoted 20 lines · Paulo Alcantara
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) <[email protected]>--- fs/cifs/cifsglob.h | 1 + fs/cifs/connect.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-)fs/cifs/cifsglob.h +0
-0
fs/cifs/cifsglob.h struct cifs_tcon { · line 1243
Quoted 4 lines
fs/cifs/cifsglob.h +1
-0@@ -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;
Why add such a special-case flag, instead of simply checking the dialect, or (betyter) the server's multichannel capability attribute?
It seems fragile and untestable to set a flag like this, especially in the tcon, which has nothing to do with supporting the multichannel fsctl.
Tom.
Quoted 39 lines
fs/cifs/cifsglob.h +0
-0struct delayed_work query_interfaces;/* query interfaces workqueue job */ };fs/cifs/connect.c +12
-6@@ -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);
Quoted 29 lines · Tom Talpey
Quoted 20 lines · Paulo Alcantara
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) <[email protected]>--- fs/cifs/cifsglob.h | 1 + fs/cifs/connect.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-)fs/cifs/cifsglob.h +0
-0fs/cifs/cifsglob.h struct cifs_tcon { · line 1243
Quoted 4 lines
fs/cifs/cifsglob.h +1
-0@@ -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;Why add such a special-case flag, instead of simply checking the dialect, or (betyter) the server's multichannel capability attribute?
Quoted 3 lines
It seems fragile and untestable to set a flag like this, especially in the tcon, which has nothing to do with supporting the multichannel fsctl.
Makes sense. I'll fix it in v2.
Thanks.
PATCH v2 1/1 cifs: do not query ifaces on smb1 mounts
In reply to Paulo AlcantaraUsers 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.
---
v1 -> v2:
remove cifs_tcon::iface_query_poll and then check version and server's capability multichannel
fs/cifs/connect.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/cifs/connect.c +6 -3
@@ -2606,11 +2606,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 (ses->server->dialect >=SMB30_PROT_ID && + (ses->server->capabilities &SMB2_GLOBAL_CAP_MULTI_CHANNEL )) { +/* schedule query interfaces poll */ +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);
Signature · 1 line
2.39.0
tentatively merged into cifs-2.6.git for-next pending testing and additional reviews
Quoted 45 lines · Paulo Alcantara
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) <[email protected]>Signed-off-by Steve French <[email protected]>---
v1 -> v2:
removecifs_tcon::iface_query_polland then check version and server's capability multichannelfs/cifs/connect.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)fs/cifs/connect.c +6
-4@@ -2606,11 +2606,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 (ses->server->dialect >=SMB30_PROT_ID && + (ses->server->capabilities &SMB2_GLOBAL_CAP_MULTI_CHANNEL )) { +/* schedule query interfaces poll */ +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
Signature · 3 lines
Thanks, Steve
Quoted 24 lines · Paulo Alcantara
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) <[email protected]>Signed-off-by Steve French <[email protected]>---
v1 -> v2:
removecifs_tcon::iface_query_polland then check version and server's capability multichannelfs/cifs/connect.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)fs/cifs/connect.c +0
-0
fs/cifs/connect.c cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) · line 2611
Quoted 9 lines
fs/cifs/connect.c +1
-3@@ -2606,11 +2606,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 (ses->server->dialect >= SMB30_PROT_ID &&
The dialect test is actually unnecessary, because the server global capability, indicating the support, is what's important. But it's harmless to be explicit, so...
LGTM.
Quoted 8 lines
fs/cifs/connect.c +5
-0+ (ses->server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) { +/* schedule query interfaces poll */ +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);
Quoted 29 lines · Tom Talpey
Quoted 28 lines · Paulo Alcantara
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) <[email protected]>Signed-off-by Steve French <[email protected]>---
v1 -> v2:
removecifs_tcon::iface_query_polland then check version and server's capability multichannelfs/cifs/connect.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)fs/cifs/connect.c +0
-0@@ -2606,11 +2606,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,
Quoted 8 lines
fs/cifs/connect.c cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) · line 2611
Quoted 4 lines
fs/cifs/connect.c +1
-2smb2_query_server_interfaces); -queue_delayed_work (cifsiod_wq, &tcon->query_interfaces, - (SMB_INTERFACE_POLL_INTERVAL *HZ )); + if (ses->server->dialect >= SMB30_PROT_ID &&The dialect test is actually unnecessary, because the server global capability, indicating the support, is what's important. But it's harmless to be explicit, so..
The dialect test is still necessary, otherwise we'd end up mixing SMB2_GLOBAL_CAP_MULTI_CHANNEL with CAP_LARGE_FILES[1] and then scheduling the worker for smb1 mounts.
I quickly tested it and the global cap test passed for smb1 mount due to CAP_LARGE_FILES being set.
[1] https://git.cjr.nz/linux.git/tree/fs/cifs/cifspdu.h#n533
Quoted 12 lines
Reviewed-by Tom Talpey <[email protected]>LGTM.
Quoted 7 lines
fs/cifs/connect.c +5
-0+ (ses->server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) { +/* schedule query interfaces poll */ +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);
Tom Talpey
reviewerQuoted 39 lines · Paulo Alcantara
Quoted 29 lines · Tom Talpey
Quoted 28 lines · Paulo Alcantara
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) <[email protected]>Signed-off-by Steve French <[email protected]>---
v1 -> v2:
removecifs_tcon::iface_query_polland then check version and server's capability multichannelfs/cifs/connect.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)fs/cifs/connect.c +0
-0@@ -2606,11 +2606,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,Quoted 8 lines
fs/cifs/connect.c cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) · line 2611
Quoted 4 lines
fs/cifs/connect.c +1
-2smb2_query_server_interfaces); -queue_delayed_work (cifsiod_wq, &tcon->query_interfaces, - (SMB_INTERFACE_POLL_INTERVAL *HZ )); + if (ses->server->dialect >= SMB30_PROT_ID &&The dialect test is actually unnecessary, because the server global capability, indicating the support, is what's important. But it's harmless to be explicit, so..
Quoted 1 line
The dialect test is still necessary, otherwise we'd end up mixing
SMB2_GLOBAL_CAP_MULTI_CHANNELwith CAP_LARGE_FILES[1] and then scheduling the worker for smb1 mounts.
Oh, yuck.
OK.
Quoted 19 lines
I quickly tested it and the global cap test passed for smb1 mount due to
CAP_LARGE_FILESbeing set.[1] https://git.cjr.nz/linux.git/tree/fs/cifs/cifspdu.h#n533
Quoted 12 lines
Reviewed-by Tom Talpey <[email protected]>LGTM.
Quoted 7 lines
fs/cifs/connect.c +5
-0+ (ses->server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) { +/* schedule query interfaces poll */ +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);