Skip to content

Commit 27e1fd3

Browse files
sprasad-microsoftSteve French
authored andcommitted
cifs: after disabling multichannel, mark tcon for reconnect
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: ee1d217 ("cifs: handle when server stops supporting multichannel") Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 861deac commit 27e1fd3

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

fs/smb/client/connect.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,17 +216,21 @@ cifs_mark_tcp_ses_conns_for_reconnect(struct TCP_Server_Info *server,
216216
/* If server is a channel, select the primary channel */
217217
pserver = SERVER_IS_CHAN(server) ? server->primary_server : server;
218218

219+
/*
220+
* if the server has been marked for termination, there is a
221+
* chance that the remaining channels all need reconnect. To be
222+
* on the safer side, mark the session and trees for reconnect
223+
* for this scenario. This might cause a few redundant session
224+
* setup and tree connect requests, but it is better than not doing
225+
* a tree connect when needed, and all following requests failing
226+
*/
227+
if (server->terminate) {
228+
mark_smb_session = true;
229+
server = pserver;
230+
}
219231

220232
spin_lock(&cifs_tcp_ses_lock);
221233
list_for_each_entry_safe(ses, nses, &pserver->smb_ses_list, smb_ses_list) {
222-
/*
223-
* if channel has been marked for termination, nothing to do
224-
* for the channel. in fact, we cannot find the channel for the
225-
* server. So safe to exit here
226-
*/
227-
if (server->terminate)
228-
break;
229-
230234
/* check if iface is still active */
231235
if (!cifs_chan_is_iface_active(ses, server))
232236
cifs_chan_update_iface(ses, server);

0 commit comments

Comments
 (0)