I just updated the patch in for-next (see attached) I removed the unneeded export of smb2_query_server_interfaces() but it looks like the logging of failed network interface queries is fine (and is an FYI message so not turned on automatically) - I could definitely see cases where FYI logging is turned on to see why query server interfaces failed even in the EOPNOTSUPP case - so the debug FYI looks ok to me On Wed, Nov 8, 2023 at 10:02 AM Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote: > > Paulo Alcantara <pc@xxxxxxxxxxxxx> writes: > > > Steve French <smfrench@xxxxxxxxx> writes: > > > >> removed cc:stable and changed > >> > >>> + cifs_dbg(VFS, "server %s supports multichannel now\n", > >>> + ses->server->hostname); > >> > >> to` > >> > >> + cifs_server_dbg(VFS, "supports > >> multichannel now\n"); > > > > Looks good, thanks. > > > >> Let me know if that is ok for you. (See attached updated patch) > > > > For the s/cifs_dbg/cifs_server_dbg/ change, it is. > > BTW, this patch in for-next branch still contains > > (1) misleading export of smb2_query_server_interfaces() > > (2) removal of mod_delayed_work() when reconnect failed > > (3) logging of failed network interface queries even when server > doesn't support it. > -- Thanks, Steve
From 07a290c9d27bdedfba3cf0910768969ea553157e Mon Sep 17 00:00:00 2001 From: Shyam Prasad N <sprasad@xxxxxxxxxxxxx> Date: Fri, 13 Oct 2023 11:33:21 +0000 Subject: [PATCH] cifs: handle when server starts supporting multichannel When the user mounts with multichannel option, but the server does not support it, there can be a time in future where it can be supported. With this change, such a case is handled. Signed-off-by: Shyam Prasad N <sprasad@xxxxxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> --- fs/smb/client/connect.c | 3 +++ fs/smb/client/smb2pdu.c | 30 +++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index b514b41cc9f0..55cf70800bb5 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -134,6 +134,9 @@ static void smb2_query_server_interfaces(struct work_struct *work) if (rc) { cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n", __func__, rc); + + if (rc == -EOPNOTSUPP) + return; } queue_delayed_work(cifsiod_wq, &tcon->query_interfaces, diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index b7665155f4e2..65636bdf6cdf 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -163,6 +163,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, int rc = 0; struct nls_table *nls_codepage = NULL; struct cifs_ses *ses; + int xid; /* * SMB2s NegProt, SessSetup, Logoff do not have tcon yet so @@ -307,17 +308,40 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon, tcon->need_reopen_files = true; rc = cifs_tree_connect(0, tcon, nls_codepage); - mutex_unlock(&ses->session_mutex); cifs_dbg(FYI, "reconnect tcon rc = %d\n", rc); if (rc) { /* If sess reconnected but tcon didn't, something strange ... */ + mutex_unlock(&ses->session_mutex); cifs_dbg(VFS, "reconnect tcon failed rc = %d\n", rc); goto out; } - if (smb2_command != SMB2_INTERNAL_CMD) - mod_delayed_work(cifsiod_wq, &server->reconnect, 0); + if (!rc && + (server->capabilities & SMB2_GLOBAL_CAP_MULTI_CHANNEL)) { + mutex_unlock(&ses->session_mutex); + + /* + * query server network interfaces, in case they change + */ + xid = get_xid(); + rc = SMB3_request_interfaces(xid, tcon, false); + free_xid(xid); + + if (rc) + cifs_dbg(FYI, "%s: failed to query server interfaces: %d\n", + __func__, rc); + + if (ses->chan_max > ses->chan_count && + !SERVER_IS_CHAN(server)) { + if (ses->chan_count == 1) + cifs_server_dbg(VFS, "supports multichannel now\n"); + + cifs_try_adding_channels(ses); + } + } else { + mutex_unlock(&ses->session_mutex); + } atomic_inc(&tconInfoReconnectCount); out: -- 2.39.2