[PATCH 4/9] smb: client: sync retrans on remount

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

The retrans mount option controls how many times the client retries
sending a request before giving up. Although remount already stored
the new value in cifs_sb->ctx, it was never propagated to
server->retrans, so the running connection kept using the old count.

Introduce smb3_sync_server_opts() to push ctx options that live on
TCP_Server_Info into the live server struct after a successful
remount. For now it handles retrans; subsequent patches will extend
it to other server-level knobs.

The assignment is guarded (if ctx->retrans) so that a bare
'mount -o remount' (which re-parses /proc/mounts and gets
retrans=0 because cifs_show_options does not print it) does not
accidentally reset the value to zero.

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

diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
index 90e83f07c870..31b82f8f7ead 100644
--- a/fs/smb/client/fs_context.c
+++ b/fs/smb/client/fs_context.c
@@ -1336,6 +1336,21 @@ static void smb3_sync_tcon_opts(struct cifs_sb_info *cifs_sb,
spin_unlock(&cifs_sb->tlink_tree_lock);
}

+/*
+ * 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.
+ */
+static void smb3_sync_server_opts(struct cifs_sb_info *cifs_sb)
+{
+ struct TCP_Server_Info *server = cifs_sb_master_tcon(cifs_sb)->ses->server;
+ struct smb3_fs_context *ctx = cifs_sb->ctx;
+
+ if (ctx->retrans)
+ server->retrans = ctx->retrans;
+}
+
static int smb3_reconfigure(struct fs_context *fc)
{
struct smb3_fs_context *ctx = smb3_fc2context(fc);
@@ -1475,6 +1490,8 @@ static int smb3_reconfigure(struct fs_context *fc)
#endif
if (!rc)
smb3_sync_tcon_opts(cifs_sb, cifs_sb->ctx);
+ if (!rc)
+ smb3_sync_server_opts(cifs_sb);

return rc;
}
--
2.43.0