[PATCH v2] smb: client: sync echo_interval on remount

rajasimandalos
2026-04-22T04:42:45Z

echo_interval is accepted during remount parsing but
server->echo_interval is only set in cifs_get_tcp_session() at
connection setup. A remount with a new echo_interval value silently
has no effect on the echo keepalive timer.

Add echo_interval to smb3_sync_server_opts() under srv_lock so the
new interval is pushed to the live server struct. Reschedule the echo
delayed work via mod_delayed_work() so the new interval takes effect
immediately rather than after the current timer fires.

Signed-off-by: Rajasi Mandal <rajasimandal@microsoft.com>
---
fs/smb/client/fs_context.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
index fd1060483bf2..45173f287f00 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -1329,9 +1329,9 @@ static void smb3_sync_tcon_opts(struct cifs_sb_info *cifs_sb,

/*
* Synchronize server-level options that are stored on TCP_Server_Info
- * at mount time. These fields are consulted at runtime (retry logic)
- * so remount needs to update the live server struct in addition to
- * cifs_sb->ctx.
+ * at mount time. These fields are consulted at runtime (echo work,
+ * retry logic) so remount needs to update the live server struct in
+ * addition to cifs_sb->ctx.
*/
static void smb3_sync_server_opts(struct cifs_sb_info *cifs_sb)
{
@@ -1341,7 +1341,13 @@ static void smb3_sync_server_opts(struct cifs_sb_info *cifs_sb)
spin_lock(&server->srv_lock);
if (ctx->retrans)
server->retrans = ctx->retrans;
+ if (ctx->echo_interval)
+ server->echo_interval = ctx->echo_interval * HZ;
spin_unlock(&server->srv_lock);
+
+ if (ctx->echo_interval)
+ mod_delayed_work(cifsiod_wq, &server->echo,
+ server->echo_interval);
}

static int smb3_reconfigure(struct fs_context *fc)
--
2.43.0