[PATCH] smb: client: fix first failure in negotiation after server reboot
"zhangjian (CG)" <[email protected]> Fri, 13 Jun 2025 18:24:19 +0800
| Newsgroups | gmane.linux.kernel,gmane.linux.file-systems.cifs,gmane.linux.kernel.cifs |
|---|---|
| Message-ID | <[email protected]> |
after fabc4ed200f9, server_unresponsive add a condition to check whether
client need to reconnect depending on server->lstrp. When client failed
to reconnect in 180s, client will abort connection and update server-
>lstrp for the last time. In the following scene, server->lstrp is too
old, which may cause failure for the first negotiation.
client | server
-----------------------------------------------+-----------
mount to cifs server |
ls |
| reboot
stuck for 180s and return EHOSTDOWN |
abort connection and update server->lstrp |
| service smb restart
ls |
smb_negotiate |
server_unresponsive is true [in cifsd] |
cifs_sync_mid_result return EAGAIN |
smb_negotiate return EHOSTDOWN |
ls failed |
we update server->lstrp before last switching into CifsInNegotiate state
to avoid this failure.
Fixes: fabc4ed200f9 ("smb: client: fix hang in wait_for_response() for
negproto")
Signed-off-by: zhangjian <[email protected]>
---
fs/smb/client/connect.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c
index 28bc33496..f9aef60f1 100644
--- a/fs/smb/client/connect.c
+++ b/fs/smb/client/connect.c
@@ -4193,6 +4193,7 @@ cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses,
return 0;
}
+ server->lstrp = jiffies;
server->tcpStatus = CifsInNegotiate;
spin_unlock(&server->srv_lock);
--
2.33.0