This is a note to let you know that I've just added the patch titled cifs: after disabling multichannel, mark tcon for reconnect to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: cifs-after-disabling-multichannel-mark-tcon-for-reconnect.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 27e1fd343f80168ff456785c2443136b6b7ca3cc Mon Sep 17 00:00:00 2001 From: Shyam Prasad N <sprasad@xxxxxxxxxxxxx> Date: Fri, 29 Dec 2023 11:30:07 +0000 Subject: cifs: after disabling multichannel, mark tcon for reconnect From: Shyam Prasad N <sprasad@xxxxxxxxxxxxx> commit 27e1fd343f80168ff456785c2443136b6b7ca3cc upstream. Once the server disables multichannel for an active multichannel session, on the following reconnect, the client would reduce the number of channels to 1. However, it could be the case that the tree connect was active on one of these disabled channels. This results in an unrecoverable state. This change fixes that by making sure that whenever a channel is being terminated, the session and tcon are marked for reconnect too. This could mean a few redundant tree connect calls to the server, but considering that this is not a frequent event, we should be okay. Fixes: ee1d21794e55 ("cifs: handle when server stops supporting multichannel") Signed-off-by: Shyam Prasad N <sprasad@xxxxxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/smb/client/connect.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -212,17 +212,21 @@ cifs_mark_tcp_ses_conns_for_reconnect(st /* If server is a channel, select the primary channel */ pserver = SERVER_IS_CHAN(server) ? server->primary_server : server; + /* + * if the server has been marked for termination, there is a + * chance that the remaining channels all need reconnect. To be + * on the safer side, mark the session and trees for reconnect + * for this scenario. This might cause a few redundant session + * setup and tree connect requests, but it is better than not doing + * a tree connect when needed, and all following requests failing + */ + if (server->terminate) { + mark_smb_session = true; + server = pserver; + } spin_lock(&cifs_tcp_ses_lock); list_for_each_entry_safe(ses, nses, &pserver->smb_ses_list, smb_ses_list) { - /* - * if channel has been marked for termination, nothing to do - * for the channel. in fact, we cannot find the channel for the - * server. So safe to exit here - */ - if (server->terminate) - break; - /* check if iface is still active */ spin_lock(&ses->chan_lock); if (!cifs_chan_is_iface_active(ses, server)) { Patches currently in stable-queue which might be from sprasad@xxxxxxxxxxxxx are queue-6.6/cifs-reconnect-worker-should-take-reference-on-serve.patch queue-6.6/cifs-handle-cases-where-a-channel-is-closed.patch queue-6.6/cifs-update-iface_last_update-on-each-query-and-upda.patch queue-6.6/cifs-fix-lock-ordering-while-disabling-multichannel.patch queue-6.6/cifs-reconnect-work-should-have-reference-on-server-.patch queue-6.6/revert-cifs-reconnect-work-should-have-reference-on-.patch queue-6.6/cifs-handle-servers-that-still-advertise-multichanne.patch queue-6.6/cifs-handle-when-server-starts-supporting-multichann.patch queue-6.6/cifs-handle-when-server-stops-supporting-multichanne.patch queue-6.6/cifs-after-disabling-multichannel-mark-tcon-for-reconnect.patch queue-6.6/cifs-fix-a-pending-undercount-of-srv_count.patch