diff options
| author | zhangjian (CG) <zhangjian496@huawei.com> | 2025-06-13 18:44:20 +0800 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2025-06-15 16:11:12 -0500 |
| commit | f78903df4ea57086014ac930babc95da201b3054 (patch) | |
| tree | 77bb86f9126b3e40cf42df979322c647f23d7fbb | |
| parent | e04c78d86a9699d136910cfc0bdcf01087e3267e (diff) | |
| download | linux-f78903df4ea57086014ac930babc95da201b3054.tar.gz linux-f78903df4ea57086014ac930babc95da201b3054.tar.bz2 linux-f78903df4ea57086014ac930babc95da201b3054.zip | |
smb: client: fix first failure in negotiation after server reboot
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 |
| sleep 21s
| service smb restart
ls |
smb_negotiate |
server_unresponsive cause reconnect [in cifsd] |
( tcpStatus == CifsInNegotiate && |
jiffies > server->lstrp + 20s ) |
cifs_sync_mid_result return EAGAIN |
smb_negotiate return EHOSTDOWN |
ls failed |
The condition (tcpStatus == CifsInNegotiate && jiffies > server->lstrp + 20s)
expect client stay in CifsInNegotiate state for more than 20s. So we update
server->lstrp before last switching into CifsInNegotiate state to avoid
this failure.
Fixes: 7ccc1465465d ("smb: client: fix hang in wait_for_response() for negproto")
Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Signed-off-by: zhangjian <zhangjian496@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
| -rw-r--r-- | fs/smb/client/connect.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index c4fb80b37738..c48869c29e15 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -4199,6 +4199,7 @@ retry: return 0; } + server->lstrp = jiffies; server->tcpStatus = CifsInNegotiate; spin_unlock(&server->srv_lock); |
