Linux-CIFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] cifs: fix soft mounts hanging in the reconnect code
@ 2020-02-06  3:55 Ronnie Sahlberg
  0 siblings, 0 replies; 3+ messages in thread
From: Ronnie Sahlberg @ 2020-02-06  3:55 UTC (permalink / raw)
  To: linux-cifs; +Cc: Ronnie Sahlberg

RHBZ: 1795423

This is the SMB1 version of a patch we already have for SMB2

In recent DFS updates we have a new variable controlling how many times we will
retry to reconnect the share.
If DFS is not used, then this variable is initialized to 0 in:

static inline int
dfs_cache_get_nr_tgts(const struct dfs_cache_tgt_list *tl)
{
        return tl ? tl->tl_numtgts : 0;
}

This means that in the reconnect loop in smb2_reconnect() we will immediately wrap retries to -1
and never actually get to pass this conditional:

                if (--retries)
                        continue;

The effect is that we no longer reach the point where we fail the commands with -EHOSTDOWN
and basically the kernel threads are virtually hung and unkillable.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/cifssmb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index a481296f417f..3c89569e7210 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -260,7 +260,7 @@ cifs_reconnect_tcon(struct cifs_tcon *tcon, int smb_command)
 		if (server->tcpStatus != CifsNeedReconnect)
 			break;
 
-		if (--retries)
+		if (retries && --retries)
 			continue;
 
 		/*
-- 
2.13.6


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cifs: fix soft mounts hanging in the reconnect code
  2020-01-30 19:52 Ronnie Sahlberg
@ 2020-01-30 21:24 ` Steve French
  0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2020-01-30 21:24 UTC (permalink / raw)
  To: Ronnie Sahlberg; +Cc: linux-cifs, Paulo Alcantara

Added cc:stable and Reviewed-by and merged into cifs-2.6.git for-next

On Thu, Jan 30, 2020 at 1:53 PM Ronnie Sahlberg <lsahlber@redhat.com> wrote:
>
> RHBZ: 1795429
>
> In recent DFS updates we have a new variable controlling how many times we will
> retry to reconnect the share.
> If DFS is not used, then this variable is initialized to 0 in:
>
> static inline int
> dfs_cache_get_nr_tgts(const struct dfs_cache_tgt_list *tl)
> {
>         return tl ? tl->tl_numtgts : 0;
> }
>
> This means that in the reconnect loop in smb2_reconnect() we will immediately wrap retries to -1
> and never actually get to pass this conditional:
>
>                 if (--retries)
>                         continue;
>
> The effect is that we no longer reach the point where we fail the commands with -EHOSTDOWN
> and basically the kernel threads are virtually hung and unkillable.
>
> Fixes: a3a53b7603798fd8 (cifs: Add support for failover in smb2_reconnect())
> Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
> ---
>  fs/cifs/smb2pdu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 7edba3e6d5e6..14f209f7376f 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -312,7 +312,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
>                 if (server->tcpStatus != CifsNeedReconnect)
>                         break;
>
> -               if (--retries)
> +               if (retries && --retries)
>                         continue;
>
>                 /*
> --
> 2.13.6
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] cifs: fix soft mounts hanging in the reconnect code
@ 2020-01-30 19:52 Ronnie Sahlberg
  2020-01-30 21:24 ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: Ronnie Sahlberg @ 2020-01-30 19:52 UTC (permalink / raw)
  To: linux-cifs; +Cc: Paulo Alcantara, Ronnie Sahlberg

RHBZ: 1795429

In recent DFS updates we have a new variable controlling how many times we will
retry to reconnect the share.
If DFS is not used, then this variable is initialized to 0 in:

static inline int
dfs_cache_get_nr_tgts(const struct dfs_cache_tgt_list *tl)
{
        return tl ? tl->tl_numtgts : 0;
}

This means that in the reconnect loop in smb2_reconnect() we will immediately wrap retries to -1
and never actually get to pass this conditional:

                if (--retries)
                        continue;

The effect is that we no longer reach the point where we fail the commands with -EHOSTDOWN
and basically the kernel threads are virtually hung and unkillable.

Fixes: a3a53b7603798fd8 (cifs: Add support for failover in smb2_reconnect())
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
 fs/cifs/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 7edba3e6d5e6..14f209f7376f 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -312,7 +312,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
 		if (server->tcpStatus != CifsNeedReconnect)
 			break;
 
-		if (--retries)
+		if (retries && --retries)
 			continue;
 
 		/*
-- 
2.13.6


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06  3:55 [PATCH] cifs: fix soft mounts hanging in the reconnect code Ronnie Sahlberg
  -- strict thread matches above, loose matches on Subject: below --
2020-01-30 19:52 Ronnie Sahlberg
2020-01-30 21:24 ` Steve French

Linux-CIFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-cifs/0 linux-cifs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-cifs linux-cifs/ https://lore.kernel.org/linux-cifs \
		linux-cifs@vger.kernel.org
	public-inbox-index linux-cifs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-cifs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git