diff mbox series

[03/14] cifs: reconnect helper should set reconnect for the right channel

Message ID 20231030110020.45627-3-sprasad@microsoft.com
State New
Headers show
Series [01/14] cifs: print server capabilities in DebugData | expand

Commit Message

Shyam Prasad N Oct. 30, 2023, 11 a.m. UTC
From: Shyam Prasad N <sprasad@microsoft.com>

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: dca65818c80c ("cifs: use a different reconnect helper for non-cifsd threads")
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
---
 fs/smb/client/connect.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Paulo Alcantara Oct. 31, 2023, 3:27 p.m. UTC | #1
nspmangalore@gmail.com writes:

> From: Shyam Prasad N <sprasad@microsoft.com>
>
> 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: dca65818c80c ("cifs: use a different reconnect helper for non-cifsd threads")
> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
> ---
>  fs/smb/client/connect.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)

Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Steve French Oct. 31, 2023, 6:29 p.m. UTC | #2
tentatively added to for-next pending testing

(and added Cc: stable and Paulo's RB)

On Tue, Oct 31, 2023 at 10:27 AM Paulo Alcantara <pc@manguebit.com> wrote:
>
> nspmangalore@gmail.com writes:
>
> > From: Shyam Prasad N <sprasad@microsoft.com>
> >
> > 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: dca65818c80c ("cifs: use a different reconnect helper for non-cifsd threads")
> > Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
> > ---
> >  fs/smb/client/connect.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
>
> Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
diff mbox series

Patch

diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 15a1c86482ed..c993c7a3415a 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -160,13 +160,14 @@  cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server,
 	/* If server is a channel, select the primary channel */
 	pserver = 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) {