[PATCH v3 5/9] smb: client: sync echo_interval on remount

From: rajasimandalos

Date: Thu May 21 2026 - 10:33:39 EST


From: Rajasi Mandal <rajasimandal@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
---
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 903b4060d5d0..f09ad5d470f3 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -1307,9 +1307,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)
{
@@ -1319,7 +1319,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