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

rajasimandalos
2026-04-09T10:00:06Z

Add echo_interval handling to smb3_sync_server_opts() so that
changing echo_interval via remount actually takes effect on the
running connection.

The server echo worker fires every server->echo_interval jiffies,
but that field was never updated from cifs_sb->ctx on remount.
Convert the user-supplied seconds value to jiffies and reschedule
the echo worker with mod_delayed_work() so the new interval is
picked up immediately.

The assignment is guarded (if ctx->echo_interval) so that an
explicit echo_interval=0 does not accidentally reset the interval.

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

diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
index 31b82f8f7ead..5f0637035172 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -1338,9 +1338,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)
{
@@ -1349,6 +1349,11 @@ static void smb3_sync_server_opts(struct cifs_sb_info *cifs_sb)

if (ctx->retrans)
server->retrans = ctx->retrans;
+ if (ctx->echo_interval) {
+ server->echo_interval = ctx->echo_interval * HZ;
+ mod_delayed_work(cifsiod_wq, &server->echo,
+ server->echo_interval);
+ }
}

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