Skip to content

Commit

Permalink
cifs: reconnect helper should set reconnect for the right channel
Browse files Browse the repository at this point in the history
commit c3326a6 upstream.

We introduced a helper function to be used by non-cifsd threads to
mark the connection for reconnect. For multichannel, when only
a particular channel needs to be reconnected, this had a bug.

This change fixes that by marking that particular channel
for reconnect.

Fixes: dca6581 ("cifs: use a different reconnect helper for non-cifsd threads")
Cc: stable@vger.kernel.org
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
sprasad-microsoft authored and gregkh committed Nov 28, 2023
1 parent b9bb960 commit 9bf434f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fs/smb/client/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,14 @@ cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
/* If server is a channel, select the primary channel */
pserver = CIFS_SERVER_IS_CHAN(server) ? server->primary_server : server;

spin_lock(&pserver->srv_lock);
/* if we need to signal just this channel */
if (!all_channels) {
pserver->tcpStatus = CifsNeedReconnect;
spin_unlock(&pserver->srv_lock);
spin_lock(&server->srv_lock);
if (server->tcpStatus != CifsExiting)
server->tcpStatus = CifsNeedReconnect;
spin_unlock(&server->srv_lock);
return;
}
spin_unlock(&pserver->srv_lock);

spin_lock(&cifs_tcp_ses_lock);
list_for_each_entry(ses, &pserver->smb_ses_list, smb_ses_list) {
Expand Down

0 comments on commit 9bf434f

Please sign in to comment.