Skip to contentSkip to conversation

cifs: fix soft mounts hanging in the reconnect code

PATCH In review Ronnie Sahlberg 2 participants 2 messages Jan 30, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: fix soft mounts hanging in the reconnect code

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())
---
 fs/cifs/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2pdu.c +1 -1
index 7edba3e6d5e6..14f209f7376f 100644
@@ -312,7 +312,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
 		if (server->tcpStatus != CifsNeedReconnect)
 			break;
 
-		if (--retries)
+		if (retries && --retries)
 			continue;
 
 		/*
Signature · 1 line
2.13.6
#1 lore raw

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

Quoted 44 lines · 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())
---
 fs/cifs/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/smb2pdu.c +1 -2
index 7edba3e6d5e6..14f209f7376f 100644
@@ -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

Signature · 3 lines
Thanks,

Steve