[PATCH 0/5] smb: client: don't sleep through reconnects and umount
From: Stefan Metzmacher
Date: Tue Dec 01 2026 - 11:51:06 EST
Hi Paulo,
these remove fixed sleeps from the client's reconnect and shutdown
paths, which delayed e.g. an umount after the server or the local
address went away:
- The reconnect loops slept 3 seconds between attempts, also when
the server was already exiting; wait on server->response_q
instead.
- clean_demultiplex_info() slept 46 seconds if mids were still
pending; wait until they are gone instead (with the same maximum).
- Add cifs_server_wait_exiting() and use it for the other sleeps in
the demultiplex thread and for the replay back-off.
- Soft mounts give up waiting for the reconnect once the next
reconnect attempt failed with a local error (e.g. the address was
removed: -EADDRNOTAVAIL, -ENETUNREACH, -ENETDOWN, -ENODEV) instead
of 10 seconds per target; short outages like a server restart
still keep waiting.
The fixed sleeps are gone for all transports. Giving up early on
local errors works for TCP now; for SMB over RDMA it needs smbdirect
to report such errors, which comes with separate changes for
smbdirect.
These patches were developed with the help of Claude (Anthropic),
which was used for code analysis, writing parts of the code and the
commit messages. I reviewed all changes and take full responsibility
for them.
Base: paulo-linux/cifs-next (f5ed6b20ad03).
Stefan Metzmacher (5):
smb: client: stop waiting between reconnect attempts once the server
exits
smb: client: wait for pending mids instead of sleeping 46 seconds
smb: client: add cifs_server_wait_exiting()
smb: client: use cifs_server_wait_exiting() for the replay back-off
smb: client: soft mounts only wait until a reconnect attempt failed
locally
fs/smb/client/cached_dir.c | 2 +-
fs/smb/client/cifsglob.h | 5 ++++
fs/smb/client/cifsproto.h | 2 ++
fs/smb/client/connect.c | 61 ++++++++++++++++++++++++++++++++++----
fs/smb/client/file.c | 7 +++--
fs/smb/client/link.c | 2 +-
fs/smb/client/misc.c | 46 +++++++++++++++++++++++-----
fs/smb/client/smb2inode.c | 6 ++--
fs/smb/client/smb2ops.c | 8 ++---
fs/smb/client/smb2pdu.c | 28 ++++++++---------
fs/smb/client/transport.c | 16 ++++++++++
11 files changed, 144 insertions(+), 39 deletions(-)
--
2.43.0