From nobody Sun May 24 20:33:08 2026 Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1D093CBE97 for ; Thu, 21 May 2026 13:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371684; cv=none; b=gkm6FsVe9mC1z+QvC1KCCqP4A0jYhjq8VIGMV44uBWIwKXWUjoWpUKiPHtlhFiHBgqToPlZaxI8sHBUr0gt6Raaf2v2XYpwfO5BZgg1NSSzmuJ/WoBk4gwSzBS+/abbn9d4JJRL0d6zkuNcruIMY5eHrKQ/22rJnEDj55mQwOEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371684; c=relaxed/simple; bh=HPZNgfPv4NOwHRE+ejIrpad+UOQEhVdWYqPyCS8N2Xg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PkXW300FOTQhQIn6toxRyqyaxc3EV7okOcN40xKcxq9riGZPgFfZTuo3k0SwEBJBGCrGcoaSHWyTVkNgw970lSjPKc9LMOOoaxw0YqDMq8KUhRMVTr6800HigFcD9PJDnqnbaBs/EdrSdGxO+CJ9Kcp1MjkdQn0864NCmVDdTEQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YmotkIYw; arc=none smtp.client-ip=209.85.215.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YmotkIYw" Received: by mail-pg1-f173.google.com with SMTP id 41be03b00d2f7-c6dd5b01e14so2894017a12.0 for ; Thu, 21 May 2026 06:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779371682; x=1779976482; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rMMzrE02cBSizde/b8sQjJmuGF0rKjzqTNZ362Dbx5c=; b=YmotkIYwjpU4FuqUOxWXwhq+YcJWyR0VOYWEWWsEZDyGi23pSnj5Xx8DkzH8DVSTIw KL+qfTBRkOV/a5K6n+hYv+3zBMN299Mw7sYIJ7saYR7lQwCYLVA+nr3PfYthf7R6/Jap gvs1Sts9COjoDF10YgxhluOpQbt4RVIKAYGK8Z2ZbW+InOKkIKCOfLSbQAFUOIsaanIB 0CDNIq9B+mBwoGe29y2oHp1cVvsbMouj7LfQbXkpe7l+QxRxwTIPFBtI1yJr7xfJUcgo eLMPB3XDpKVhWQbQ+OWTnHFCnxvqZWlxxB2qE7lSnWjdbKSnsD6+M1d5cuiP/4vtDr9H xr9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779371682; x=1779976482; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rMMzrE02cBSizde/b8sQjJmuGF0rKjzqTNZ362Dbx5c=; b=Y9decwYagk0Wo6biEbLYuIPZIfR+HzH7XdsSH+9ml0yOpCkSBR6XrZT/uJhmdG+JI6 v6P03e0jTEd8Nm7iv/K9zREJd4xwGt2kSpWSODid9ywWA2nPvhy63P8MFhyJ+sBYcJhJ zPKQN5U+a61NR3q/hw1zMy084O6l7HNWpQuROxsvQEGXvnGALIbaxX6f0BkzXqHFTSsn xGuS5d2kZ/YzFmJ+Pqh8d6MR5j/NV/XoWSP/4/SC8mdOEBlCLClaGFcQZsvP4rYLnoA0 OabA6Z9AyW8Qx1Gum1nAY18LDEtpRrJzBlhd1hMymA4hQ+jw0bYS0lXDcvNoXCTBI3HH Y42w== X-Forwarded-Encrypted: i=1; AFNElJ9hgcFe+MO9p13WZ/nVp9SVcko1wbb6FAwrmQACgkZvUrEftgcJgzr0qdErBUTvrVR38RHrSjJNj87ikpc=@vger.kernel.org X-Gm-Message-State: AOJu0YyZ1JoukbkzGotQgtNxm8LSsB55YjXv8061dhLgZCpHaTUuv8X7 SCKnLzX2Jdm6noUH/qeM8Z8BRJLTZ7FXUghZ5QQnB6JG/+gPLO7e6d5m X-Gm-Gg: Acq92OEmkOa5MD8Xfct831lx/L9tkEBcvTymP18ZVtb2reBG1XRsYtE6HmnA9+Lr0gv d6ptww3fMTq5zfbylDVqIcaZ80q4TL9eEO2fKPhfpwmIepA7KcTAT62F8TXFRfIfHKvcGp+5xHU BH/O/wYXO8gaCfxaW0ieQDiqU5hOEpjoA3n7XWoMu0wbV90SBPSyFv7eurTNsmw07yExutfeqgx TcirbpMOZG3fz8vlra8ZvXHS24SP3Cy+9qwgKN/fhKUhjV1R7hogadweUgmRmLuFnm7I1q/anqv K4tqyN+5RlF7heSxyRDrA48vB0Ds5UJBKv3er6qbxbCQRN1fyU+2+e+/+aqHw++3S25z8c2//dd r16uTLfjCP0rqCC0rhftVYqgcWAxQTovJ6M+EVRPhus6HAVA8GnSIOExK/Qxj/W9e9a2TqbNNm7 /AG9Tj08eF4cVsioUrQxCIVCFVOosOrDzOtXrv0w0CkpgfhYuwKAmg1iDqRbFbY26cijm4eRr1t eeK18g3TRqk2j0l/lkwOWstn6gMkz2G4Q== X-Received: by 2002:a05:6a20:9195:b0:3aa:f9cb:d438 with SMTP id adf61e73a8af0-3b3085d23e3mr3772719637.21.1779371682199; Thu, 21 May 2026 06:54:42 -0700 (PDT) Received: from dev-vm-rm.hzz4ddxqtfeetjrh00qlbgyytb.rx.internal.cloudapp.net ([20.197.52.255]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c85197c72b3sm455378a12.4.2026.05.21.06.54.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 06:54:41 -0700 (PDT) From: rajasimandalos@gmail.com To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Meetakshi Setiya Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Rajasi Mandal Subject: [PATCH v3 1/9] smb: client: sync runtime state into ctx on reconfigure Date: Thu, 21 May 2026 13:54:07 +0000 Message-ID: <5eeeecdba9a2ab93074b5fbac505b83f35aac18f.1779371115.git.rajasimandal@microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rajasi Mandal smb3_init_fs_context() builds a fresh context with init defaults on every call, including reconfigure (remount). Many fields displayed by cifs_show_options() are sourced from tcon/server/ses rather than from ctx, so the init defaults do not reflect the live mount and cannot be used as a baseline for comparing new vs old options on remount. Detect FS_CONTEXT_FOR_RECONFIGURE in smb3_init_fs_context() and duplicate the existing cifs_sb->ctx instead. Before duplicating, sync ctx with runtime state via a new helper smb3_sync_ctx_from_runtime() so the baseline matches what cifs_show_options() displays. Add srv_lock / tc_lock around the relevant runtime writers (SMB2_negotiate, SMB2_tcon, reset_cifs_unix_caps, cifs_swn_set_server_dstaddr) so the helper can read them without torn-read races. Also preserve inherited multichannel/max_channels values in smb3_handle_conflicting_options() during reconfigure when neither option is explicitly specified, since the dup'd context already carries them. This is preparatory plumbing for a subsequent commit that compares new_ctx against old_ctx in smb3_verify_reconfigure_ctx() to reject non-reconfigurable option changes. Signed-off-by: Rajasi Mandal --- fs/smb/client/cifs_swn.h | 14 ++++- fs/smb/client/fs_context.c | 117 ++++++++++++++++++++++++++++++++++++- fs/smb/client/smb1ops.c | 7 ++- fs/smb/client/smb2pdu.c | 11 +++- 4 files changed, 143 insertions(+), 6 deletions(-) diff --git a/fs/smb/client/cifs_swn.h b/fs/smb/client/cifs_swn.h index 955d07b69450..caf0779d4d07 100644 --- a/fs/smb/client/cifs_swn.h +++ b/fs/smb/client/cifs_swn.h @@ -26,11 +26,21 @@ void cifs_swn_check(void); =20 static inline bool cifs_swn_set_server_dstaddr(struct TCP_Server_Info *ser= ver) { + bool ret =3D false; + + /* + * srv_lock serializes the 128-byte sockaddr_storage write against + * concurrent readers (e.g. cifs_show_address(), reconn_set_ipaddr_ + * from_hostname() snapshot, smb3_sync_ctx_from_runtime()) and other + * writers like cifs_chan_update_iface() which already use srv_lock. + */ + spin_lock(&server->srv_lock); if (server->use_swn_dstaddr) { server->dstaddr =3D server->swn_dstaddr; - return true; + ret =3D true; } - return false; + spin_unlock(&server->srv_lock); + return ret; } =20 static inline void cifs_swn_reset_server_dstaddr(struct TCP_Server_Info *s= erver) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 2f86158f85d7..b93d6ef13463 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -717,13 +717,13 @@ static int smb3_handle_conflicting_options(struct fs_= context *fc) ctx->multichannel =3D true; else ctx->multichannel =3D false; - } else { + } else if (fc->purpose !=3D FS_CONTEXT_FOR_RECONFIGURE) { ctx->multichannel =3D false; ctx->max_channels =3D 1; } + /* For reconfigure with neither specified, keep inherited values */ } =20 - //resetting default values as remount doesn't initialize fs_context again ctx->multichannel_specified =3D false; ctx->max_channels_specified =3D false; =20 @@ -921,6 +921,85 @@ static void smb3_fs_context_free(struct fs_context *fc) smb3_cleanup_fs_context(ctx); } =20 +/* + * Sync cifs_sb->ctx with the runtime state visible through /proc/mounts. + * cifs_show_options() reads many fields from tcon/server/ses rather than + * from ctx. On remount, libmount reads /proc/mounts and feeds those + * values back as mount options. To avoid false mismatches between the + * old ctx and the newly parsed options, we must ensure ctx reflects + * the current runtime state before it is duplicated into the new + * remount context. + * + * Note: sb->s_umount is not yet held when VFS calls init_fs_context() + * for reconfigure, so in theory concurrent I/O paths could read + * cifs_sb->ctx fields (e.g. cifs_symlink_type()) while we write them. + * This is safe because all fields written here are word-sized + * (bool/int/pointer), so stores are architecturally atomic. The same + * unsynchronized-read pattern already exists in cifs_show_options(). + */ +static void smb3_sync_ctx_from_runtime(struct cifs_sb_info *cifs_sb) +{ + struct cifs_tcon *tcon =3D cifs_sb_master_tcon(cifs_sb); + struct TCP_Server_Info *server =3D tcon->ses->server; + struct cifs_ses *ses =3D tcon->ses; + struct smb3_fs_context *ctx =3D cifs_sb->ctx; + const char *domain; + int unicode; + + /* + * Server fields that can drift from ctx after mount: + * - ops/vals: dialect renegotiation during reconnect (paired, + * so read under srv_lock to match the writer in SMB2_negotiate) + * - dstaddr: SWN witness failover updates server->dstaddr; the + * 128-byte sockaddr_storage is not atomic, so srv_lock is + * required against torn reads + * - nosharesock: can be flipped to true post-mount by SMB2_tcon + * on STATUS_BAD_NETWORK_NAME with ISOLATED_TRANSPORT, so read + * under srv_lock to pair with that writer + */ + spin_lock(&server->srv_lock); + ctx->ops =3D server->ops; + ctx->vals =3D server->vals; + ctx->dstaddr =3D server->dstaddr; + ctx->nosharesock =3D server->nosharesock; + spin_unlock(&server->srv_lock); + + /* + * tcon->unix_ext can be flipped post-mount by reset_cifs_unix_caps() + * on SMB1 reconnect (smb1_reconnect path). Read under tc_lock to pair + * with that writer. tcon->posix_extensions is only ever set at + * mount-time pre-publish, but read it under the same lock so the + * derived linux_ext/no_linux_ext pair is consistent. + */ + spin_lock(&tcon->tc_lock); + if (tcon->posix_extensions || tcon->unix_ext) { + ctx->linux_ext =3D 1; + ctx->no_linux_ext =3D 0; + } else { + ctx->linux_ext =3D 0; + ctx->no_linux_ext =3D 1; + } + spin_unlock(&tcon->tc_lock); + ctx->seal =3D tcon->seal; + ctx->persistent =3D tcon->use_persistent; + ctx->nopersistent =3D !tcon->use_persistent; + ctx->resilient =3D tcon->use_resilient; + ctx->witness =3D tcon->use_witness; + + /* + * Session fields: domainName and unicode are effectively + * write-once (set during session setup, never freed/replaced + * while the session exists), so plain reads are safe. + */ + domain =3D ses->domainName; + unicode =3D ses->unicode; + + if (domain && !ctx->domainname) + ctx->domainname =3D kstrdup(domain, GFP_KERNEL); + if (unicode >=3D 0) + ctx->unicode =3D unicode; +} + /* * Compare the old and new proposed context during reconfigure * and check if the changes are compatible. @@ -1958,6 +2037,40 @@ int smb3_init_fs_context(struct fs_context *fc) char *nodename =3D utsname()->nodename; int i; =20 + /* + * For reconfigure (remount), duplicate the existing mount context + * instead of building one from scratch with init defaults. + * + * VFS sets fc->root before calling init_fs_context for reconfigure, + * so we can access the existing superblock's context. We first sync + * cifs_sb->ctx with runtime state (tcon/server/ses) so that ctx + * matches what cifs_show_options() displays. Then we dup old_ctx + * into new_ctx. The parser will overwrite only the options + * explicitly passed on remount, so any difference between new_ctx + * and old_ctx in smb3_verify_reconfigure_ctx() represents a real, + * intentional change by the user. + */ + if (fc->purpose =3D=3D FS_CONTEXT_FOR_RECONFIGURE) { + struct cifs_sb_info *cifs_sb =3D CIFS_SB(fc->root->d_sb); + int rc; + + smb3_sync_ctx_from_runtime(cifs_sb); + + ctx =3D kzalloc_obj(struct smb3_fs_context); + if (!ctx) + return -ENOMEM; + + rc =3D smb3_fs_context_dup(ctx, cifs_sb->ctx); + if (rc) { + kfree(ctx); + return rc; + } + + fc->fs_private =3D ctx; + fc->ops =3D &smb3_fs_context_ops; + return 0; + } + ctx =3D kzalloc_obj(struct smb3_fs_context); if (unlikely(!ctx)) return -ENOMEM; diff --git a/fs/smb/client/smb1ops.c b/fs/smb/client/smb1ops.c index e198e3dda917..a91539d7f0ba 100644 --- a/fs/smb/client/smb1ops.c +++ b/fs/smb/client/smb1ops.c @@ -36,11 +36,16 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs= _tcon *tcon, =20 if (ctx && ctx->no_linux_ext) { tcon->fsUnixInfo.Capability =3D 0; + spin_lock(&tcon->tc_lock); tcon->unix_ext =3D 0; /* Unix Extensions disabled */ + spin_unlock(&tcon->tc_lock); cifs_dbg(FYI, "Linux protocol extensions disabled\n"); return; - } else if (ctx) + } else if (ctx) { + spin_lock(&tcon->tc_lock); tcon->unix_ext =3D 1; /* Unix Extensions supported */ + spin_unlock(&tcon->tc_lock); + } =20 if (!tcon->unix_ext) { cifs_dbg(FYI, "Unix extensions disabled so not set on reconnect\n"); diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 995fcdd30681..9e07c1a99981 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -1189,8 +1189,10 @@ SMB2_negotiate(const unsigned int xid, goto neg_exit; case SMB311_PROT_ID: /* ops set to 3.0 by default for default so update */ + spin_lock(&server->srv_lock); server->ops =3D &smb311_operations; server->vals =3D &smb311_values; + spin_unlock(&server->srv_lock); break; default: break; @@ -1205,12 +1207,16 @@ SMB2_negotiate(const unsigned int xid, goto neg_exit; case SMB21_PROT_ID: /* ops set to 3.0 by default for default so update */ + spin_lock(&server->srv_lock); server->ops =3D &smb21_operations; server->vals =3D &smb21_values; + spin_unlock(&server->srv_lock); break; case SMB311_PROT_ID: + spin_lock(&server->srv_lock); server->ops =3D &smb311_operations; server->vals =3D &smb311_values; + spin_unlock(&server->srv_lock); break; default: break; @@ -2228,8 +2234,11 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *s= es, const char *tree, if (server->ops->validate_negotiate) rc =3D server->ops->validate_negotiate(xid, tcon); if (rc =3D=3D 0) /* See MS-SMB2 2.2.10 and 3.2.5.5 */ - if (tcon->share_flags & SMB2_SHAREFLAG_ISOLATED_TRANSPORT) + if (tcon->share_flags & SMB2_SHAREFLAG_ISOLATED_TRANSPORT) { + spin_lock(&server->srv_lock); server->nosharesock =3D true; + spin_unlock(&server->srv_lock); + } tcon_exit: =20 free_rsp_buf(resp_buftype, rsp); --=20 2.43.0 From nobody Sun May 24 20:33:08 2026 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72E213DE439 for ; Thu, 21 May 2026 13:54:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371688; cv=none; b=kB/+/L/jToRTh0UlGf7/+WQV4Auwjgmz+jrzJSt6bm3tbDPD+ihvaaHJ/MWCs4cx5ha0ivjiHRPCvEC6mrCpUcy6CnxAsHMrKqvFFS1DGu+WFOQx+UtcJjrLZZUZ/wXFk5jCJglmaCE+qi3Lap7DC90X8d1pcvw4NspeSYbCtf8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371688; c=relaxed/simple; bh=nYGXdwpc8GcUzVkXS9NXtV+mLT8i/xkjrbIQiskHE/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cGdOWtn18hIOlbfdcsrmd8WHqcpduebSIThF2D/2XZfCN647IAKg9HL78CqzkiHtv9WLFQbj36eSvF8NPF58vEPeFOniZUs9Lq5eX30ciHUy+MSuSl+FizO/K902Tu+064x5nX6g7ZX3tSSgLSzq89JNGxCArILpVo3Lh7dZ5j8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ku8+6y+k; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ku8+6y+k" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-c736261ee8dso2857403a12.1 for ; Thu, 21 May 2026 06:54:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779371686; x=1779976486; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qW+lr0hx7HYrcP+8C0V2LOEx2Ctr7Xu1/3AsyXMtBps=; b=Ku8+6y+kvlwX3O3XbnT9AVWNE5P0kDAASJ7J3w9ZOjADVgGxYf2D8guw2HRLDrcKRd oq3rHyUeEPw/Fp9YmEImdPH5ocBzqoSmRpbxTA8hj4RXZPu3c4RSTmDRp7TZ1NrAnaqO FF9EsUlCcnKXSWsYjBv2SucR0WUWURcIPUC4MSK6BpAlC+uGdRocI8z23KLWNTCn+SOE AdHXdHlAGHgkTlqDAXguE/i6Bx5qMTyP9yPFO9kxiR+cWvRilRDRnwve1o8S89ZQD+AD p+yJbUaV5eLBbBINZk/hsvdIJuyiyFiJYQ1LWuGxTSiRq6yuUBRx4rKMxK9jm61cNTcv otgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779371686; x=1779976486; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qW+lr0hx7HYrcP+8C0V2LOEx2Ctr7Xu1/3AsyXMtBps=; b=isv9Z6Tadur7XpgRr0jopt6tmRPFCOOayv7vwDUOY4sOnHz66skXhnK0VOnKyKXf6X 8ht0MAi2ntKN8Vyn3S/oIcz+uN9tz0ri34omgOYT0fOl1DHQx0wNwUfF0u0cN//8754d 8VRvNI9kIKzAvcIrvK+Eh8OJ4iMva1jpWbj9nf9UcuJmOk4fo6wggtMORJIkIFfRYLDh jwUozWLLQb4ciyNzY5qi0iQxEZwmEDCo6Yc75SjqhYanRd7Ao0ufvEaIH0u0EAhNCNxm nNQThbnwz/Ehw7lRsSm0nqTxcq4RV+1xsUaQRLL8f2EkDdjYr5JIuZYxTrRT0FiTYIo4 OewA== X-Forwarded-Encrypted: i=1; AFNElJ8/KImBwlrP+iGhA23pdYl1/i3WhwCfGnUQMY+d8OgwsEgvGLMVlcOBNBTEu9KSE/7bpdG8TMS0r4C3CaY=@vger.kernel.org X-Gm-Message-State: AOJu0YxPyyE7X25279Igmhd5jN7932aJnDOwqU/09LwlOwxHHeorA9rs 5H8CuXq0tHvaUJJ9XUAWzq3xdyhP9OGOdDfANkZa0UNkWLSVlOqbFFr2 X-Gm-Gg: Acq92OEWVdp7IEoB+oWVk9FfZJSOezCVP/xaqsiNI7qu75Ot/1Tg6YZ9s3O4lHzlTjt V/AkGz5Q96h2hHg2OzjfEcZlDFZIUXeXbhJaJVM/EH4X4U5Z1XkjRQbhe72c0fJ+c1jq9gBawLF eMr1szRbhkFnwGqmRkBDSHMrPzJBqOEJ93Xhp6USB9ACG66i5OwJuvf/dqM8QGnic9aGMUpEL/7 Fej6Cqj1wI3uI1ZMrlHmMjLzm2Abetlwim/EoB5s18xPg5bEfVCTncwvd/769MciLReBgvTmO60 aBCMeJi1htawDgpa1i4Br9sGx5FHdYjsW4O7/IL0B+wFiWAE6vwEFJouynyAb/VHWzeuP0Qml5Q HmxK5OHHmk0Lcv8IJnPUj+Rh2GhVfeWbuk/VQImREpD2Gh3SxpfIg7/HzRj1watq3ECS/ulSK54 HKUkcR7lkg+7uYPKXdHrGn+p+jLwTKZK4zZnq0ANiGjJKWZE+3cAEPghZtzluIeanl6zTp2zJAQ eAstK/nOIHic73Vvl+kVGI1Yq47u2Yryg== X-Received: by 2002:a05:6300:210a:b0:39c:4af6:4309 with SMTP id adf61e73a8af0-3b308586320mr3614844637.12.1779371685696; Thu, 21 May 2026 06:54:45 -0700 (PDT) Received: from dev-vm-rm.hzz4ddxqtfeetjrh00qlbgyytb.rx.internal.cloudapp.net ([20.197.52.255]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c85197c72b3sm455378a12.4.2026.05.21.06.54.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 06:54:45 -0700 (PDT) From: rajasimandalos@gmail.com To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Meetakshi Setiya Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Rajasi Mandal Subject: [PATCH v3 2/9] smb: client: block non-reconfigurable option changes on remount Date: Thu, 21 May 2026 13:54:08 +0000 Message-ID: <2421f42fd19e97a595262946def5131aa1ed1ed7.1779371115.git.rajasimandal@microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rajasi Mandal Several mount options (seal, sign, vers, ip, rdma, nosharesock, persistent/resilient handles, etc.) require tearing down the connection to take effect, but smb3_verify_reconfigure_ctx() does not reject them. A remount that changes any of these silently ignores the new value, confusing users. Now that smb3_init_fs_context() duplicates the live context (with runtime state synced in) on reconfigure, simple !=3D checks in smb3_verify_reconfigure_ctx() are sound -- a difference between new_ctx and old_ctx represents a real, intentional change by the user rather than a spurious mismatch against init defaults. Add comprehensive checks for connection-tied options with clear error messages so the user sees why the remount failed. Signed-off-by: Rajasi Mandal --- fs/smb/client/fs_context.c | 137 +++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index b93d6ef13463..0677aad237e8 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1069,6 +1069,143 @@ static int smb3_verify_reconfigure_ctx(struct fs_co= ntext *fc, cifs_errorf(fc, "can not change nbsessinit during remount\n"); return -EINVAL; } + if (new_ctx->compress !=3D old_ctx->compress) { + cifs_errorf(fc, "can not change compress during remount\n"); + return -EINVAL; + } + if (new_ctx->noblocksnd !=3D old_ctx->noblocksnd) { + cifs_errorf(fc, "can not change noblocksend during remount\n"); + return -EINVAL; + } + if (new_ctx->noautotune !=3D old_ctx->noautotune) { + cifs_errorf(fc, "can not change noautotune during remount\n"); + return -EINVAL; + } + if (new_ctx->no_sparse !=3D old_ctx->no_sparse) { + cifs_errorf(fc, "can not change nosparse during remount\n"); + return -EINVAL; + } + if (new_ctx->nodelete !=3D old_ctx->nodelete) { + cifs_errorf(fc, "can not change nodelete during remount\n"); + return -EINVAL; + } + if (new_ctx->cruid_specified && + !uid_eq(new_ctx->cred_uid, old_ctx->cred_uid)) { + cifs_errorf(fc, "can not change cruid during remount\n"); + return -EINVAL; + } + if (new_ctx->port !=3D old_ctx->port) { + cifs_errorf(fc, "can not change port during remount\n"); + return -EINVAL; + } + if (new_ctx->min_offload !=3D old_ctx->min_offload) { + cifs_errorf(fc, "can not change min_enc_offload during remount\n"); + return -EINVAL; + } + if (new_ctx->snapshot_time !=3D old_ctx->snapshot_time) { + cifs_errorf(fc, "can not change snapshot during remount\n"); + return -EINVAL; + } + if (new_ctx->max_credits !=3D old_ctx->max_credits) { + cifs_errorf(fc, "can not change max_credits during remount\n"); + return -EINVAL; + } + if (new_ctx->handle_timeout !=3D old_ctx->handle_timeout) { + cifs_errorf(fc, "can not change handletimeout during remount\n"); + return -EINVAL; + } + if (new_ctx->got_ip && + !cifs_match_ipaddr((struct sockaddr *)&new_ctx->dstaddr, + (struct sockaddr *)&old_ctx->dstaddr)) { + cifs_errorf(fc, "can not change ip during remount\n"); + return -EINVAL; + } + if (((struct sockaddr *)&new_ctx->srcaddr)->sa_family !=3D AF_UNSPEC && + memcmp(&new_ctx->srcaddr, &old_ctx->srcaddr, sizeof(new_ctx->srcaddr)= )) { + cifs_errorf(fc, "can not change srcaddr during remount\n"); + return -EINVAL; + } + if (memcmp(new_ctx->source_rfc1001_name, old_ctx->source_rfc1001_name, + RFC1001_NAME_LEN)) { + cifs_errorf(fc, "can not change netbiosname during remount\n"); + return -EINVAL; + } + if (memcmp(new_ctx->target_rfc1001_name, old_ctx->target_rfc1001_name, + RFC1001_NAME_LEN)) { + cifs_errorf(fc, "can not change servern during remount\n"); + return -EINVAL; + } + if (new_ctx->got_version && + (new_ctx->ops !=3D old_ctx->ops || new_ctx->vals !=3D old_ctx->vals))= { + cifs_errorf(fc, "can not change vers during remount\n"); + return -EINVAL; + } + if (new_ctx->witness !=3D old_ctx->witness) { + cifs_errorf(fc, "can not change witness during remount\n"); + return -EINVAL; + } + if (new_ctx->rootfs !=3D old_ctx->rootfs) { + cifs_errorf(fc, "can not change rootfs during remount\n"); + return -EINVAL; + } + if (new_ctx->linux_ext !=3D old_ctx->linux_ext || + new_ctx->no_linux_ext !=3D old_ctx->no_linux_ext) { + cifs_errorf(fc, "can not change unix during remount\n"); + return -EINVAL; + } + if (new_ctx->nocase !=3D old_ctx->nocase) { + cifs_errorf(fc, "can not change nocase during remount\n"); + return -EINVAL; + } + if (new_ctx->intr !=3D old_ctx->intr) { + cifs_errorf(fc, "can not change intr during remount\n"); + return -EINVAL; + } + if (new_ctx->no_psx_acl !=3D old_ctx->no_psx_acl) { + cifs_errorf(fc, "can not change acl during remount\n"); + return -EINVAL; + } + if (new_ctx->local_lease !=3D old_ctx->local_lease) { + cifs_errorf(fc, "can not change locallease during remount\n"); + return -EINVAL; + } + if (new_ctx->sign !=3D old_ctx->sign) { + cifs_errorf(fc, "can not change sign during remount\n"); + return -EINVAL; + } + if (new_ctx->ignore_signature !=3D old_ctx->ignore_signature) { + cifs_errorf(fc, "can not change ignore_signature during remount\n"); + return -EINVAL; + } + if (new_ctx->seal !=3D old_ctx->seal) { + cifs_errorf(fc, "can not change seal during remount\n"); + return -EINVAL; + } + if (new_ctx->nosharesock !=3D old_ctx->nosharesock) { + cifs_errorf(fc, "can not change nosharesock during remount\n"); + return -EINVAL; + } + if (new_ctx->persistent !=3D old_ctx->persistent || + new_ctx->nopersistent !=3D old_ctx->nopersistent) { + cifs_errorf(fc, "can not change persistenthandles during remount\n"); + return -EINVAL; + } + if (new_ctx->resilient !=3D old_ctx->resilient) { + cifs_errorf(fc, "can not change resilienthandles during remount\n"); + return -EINVAL; + } + if (new_ctx->sockopt_tcp_nodelay !=3D old_ctx->sockopt_tcp_nodelay) { + cifs_errorf(fc, "can not change tcpnodelay during remount\n"); + return -EINVAL; + } + if (new_ctx->domainauto !=3D old_ctx->domainauto) { + cifs_errorf(fc, "can not change domainauto during remount\n"); + return -EINVAL; + } + if (new_ctx->rdma !=3D old_ctx->rdma) { + cifs_errorf(fc, "can not change rdma during remount\n"); + return -EINVAL; + } =20 return 0; } --=20 2.43.0 From nobody Sun May 24 20:33:08 2026 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17DA43EEAC6 for ; Thu, 21 May 2026 13:54:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371691; cv=none; b=mKoCT9zDkdnwDxs6LNO35VoAXxnYknTIHNO3Ze9PRZqag/W44kjhTYON+Rk2woWflyRKbI4ngD7aSIb0QgVFAsK2U4mXcnu0Pi5KvRt949ESMWcZFjCoVF1zKMpX4e/ogZ0iTenwCJLB6nD8b/U/4wyOeOHf4w9GK6Nh5KeJNrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371691; c=relaxed/simple; bh=RI10n1qN9PRuciwWVrmcV4hiTMl0q/PK3pSMNTMy8VU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l73n8rC8rEfAWhK11xC5fJttidW5uf2EZz95NBm8Gk+kuOCmwuFcfC7behM0Q+0qJLeyzm8jeEcIhLDDGbE+Zyz05bU2SO+z7iLgzv7Zaf1Whk6wh5QkMMC6wC6dutHTQ/r040hFkEgpp4Bj4WQxKkdESjBjZSED7egq/FE1j0Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=j7pegb2J; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j7pegb2J" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-c736261ee8dso2857438a12.1 for ; Thu, 21 May 2026 06:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779371689; x=1779976489; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=asw8+k1HzGDll0cdLC9LdLrDYlLoYsBqK1vXCfm5seM=; b=j7pegb2JihntqC2rWQb4+ePgnuLYlBXF7Fi8zPkQNgwok3I+WSjamNqt0u1Q2KYQA8 OnDerBatZynb/Eh7GoKe+ZvVS9/XDkIe7FGYzr2sTRIGor2wNfKMBhFdk6gapXDDymbg nb2lpF7Mum6uxzhepzY2LDY9J24x1EPzsvaQP0zMKKpQvG8VJ9lCV7acc2taP/JUnJo9 6Yf2ZiUxchz3CfJMp5ugMqMP4tb+opnFGB2kNAtDlA2ik3KcloJ7ZMMW52eOrHeOTmiG cpx/ZInTxNqOwJaAEOtmtYHAkr2P6G7hBBmI/6lZIk3rk0+x7HMQAellwkeHuTgAs7j4 X0CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779371689; x=1779976489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=asw8+k1HzGDll0cdLC9LdLrDYlLoYsBqK1vXCfm5seM=; b=XkwegkGPakk5CmEMLy/nzxf0eIpl6DRqAR7WiOpKieUd/3Pw+BJNDEmlh4bvgsDnPm sDVAYOmjz8loOeWCZ4aAGpyRAwp3y4XU2jFUyzyf6p+db9WrtvNmFdeMUfnyvMaj5qp3 7psiOomgxAo3MHRNNYLaumQpTXjG3nwJkHZFaQaEEiSb5NrFhTa+cu1DENsQnwJULpDv ybEgd+deD4lpvqJIiasTUbH2bcIdlO2qQH+/sldSbP30vlaBz6OEVYds4YDGqy/jP3Eu rKBJI7Q7IeSuYcY+znsOslWJmwe4VtHSXkqZFbtARmUNtjnnta5saFeNAoL0v9xlStFz 4lgw== X-Forwarded-Encrypted: i=1; AFNElJ+563kzpZbBk1XnXK/jR4QSjMUPTzhcdEw2E72HRKFPmzqL1urWgmgTiAG9dGkbD+3ZEgOtnwAiFqDTTGA=@vger.kernel.org X-Gm-Message-State: AOJu0YyA4/TyqaoAd7PY6isqrTHnP3+NYCk0pbY4AdAdNvhxpE77/KOy zj4+bGeXwyL9xYeQ1b5+PQbEqEhqVC+Yc4ZK/EzDipEfT955CKtiD5Z/ X-Gm-Gg: Acq92OE1SfyXI8ZdpDNPWC+CJEU+aZNht+bbeDLtTG7OdcrcoqlmEUzssXzb5fu1sIf NN0kzsPHd0lFtEUa7AOi371OePzawfpJu5ImHvRnUcqAFOYXvBGBSdeUudSKzb7ukewoxn8Yg6E qVE++nz0enjEvKRSyFqDks96Fpk9gCsyEK72gQ8tqAHajCisEHFqNpmwC0sCRSlKLARFFxm3pps HjNgxyYgxN5oN7jRcN4FtfUYGJ/3AMoOqn2cF1Dk8wCzrVCWyba1ErheWBTlrGDCMUfTkoUjZc0 XMLgtkLRfnYQHi+K+uwC5/BjPbHjP5muu7PQAhOd71S46amkJG1dbJFWlZr5wsz+W4u/33HFgkJ bTDV4LCB5vkU88+4K6uDIgrhzjmiP7GZShTCwDHYGNz2UJRjG45zjAcaiN9O2OOj2yD5mbK5qTk ugupcK8BSPPeJ1Go0RaY2iDSVehq29vVXE04GiK7uVdvElsPvUJpZWgr7Z3bmdnfP4Je8sSkAaD x46LeIBoJUZ8jh/EhVivXo= X-Received: by 2002:a05:6a20:7f86:b0:39f:2dd0:65d5 with SMTP id adf61e73a8af0-3b30879bc49mr3761495637.39.1779371689236; Thu, 21 May 2026 06:54:49 -0700 (PDT) Received: from dev-vm-rm.hzz4ddxqtfeetjrh00qlbgyytb.rx.internal.cloudapp.net ([20.197.52.255]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c85197c72b3sm455378a12.4.2026.05.21.06.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 06:54:48 -0700 (PDT) From: rajasimandalos@gmail.com To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Meetakshi Setiya Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Rajasi Mandal Subject: [PATCH v3 3/9] smb: client: sync tcon-level options on remount Date: Thu, 21 May 2026 13:54:09 +0000 Message-ID: <8c3698becdb6e3e3748bc042ffaed596dce3feb8.1779371115.git.rajasimandal@microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rajasi Mandal Several mount options are stored on each cifs_tcon at mount time but smb3_reconfigure() only updates cifs_sb->ctx. A remount that changes any of these options silently has no effect because the runtime code reads from the tcon fields, not from the superblock context. The affected options and their tcon fields are: retry -> tcon->retry max_cached_dirs -> tcon->max_cached_dirs Add smb3_sync_tcon_opts() which walks the tlink_tree under tlink_tree_lock and propagates these values from ctx to every tcon under tc_lock. Call it from smb3_reconfigure() after the context has been updated. Signed-off-by: Rajasi Mandal --- fs/smb/client/fs_context.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 0677aad237e8..f92c1cb274a6 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1273,6 +1273,38 @@ static void smb3_sync_ses_chan_max(struct cifs_ses *= ses, size_t max_channels) spin_unlock(&ses->chan_lock); } =20 +/* + * Synchronize tcon options that are derived from ctx across all tcons + * associated with this superblock. These fields are consulted at runtime + * (reconnect, I/O, unlink/rmdir) so remount needs to update the live + * tcons in addition to cifs_sb->ctx. + */ +static void smb3_sync_tcon_opts(struct cifs_sb_info *cifs_sb, + struct smb3_fs_context *ctx) +{ + struct tcon_link *tlink; + struct cifs_tcon *tcon; + struct rb_node *node; + + spin_lock(&cifs_sb->tlink_tree_lock); + for (node =3D rb_first(&cifs_sb->tlink_tree); node; node =3D rb_next(node= )) { + tlink =3D rb_entry(node, struct tcon_link, tl_rbnode); + tcon =3D tlink_tcon(tlink); + if (IS_ERR(tcon)) + continue; + + spin_lock(&tcon->tc_lock); + tcon->retry =3D ctx->retry; + /* + * Note: this updates the limit for new cached dir opens + * but does not resize or evict existing cached dirents. + */ + tcon->max_cached_dirs =3D ctx->max_cached_dirs; + spin_unlock(&tcon->tc_lock); + } + spin_unlock(&cifs_sb->tlink_tree_lock); +} + static int smb3_reconfigure(struct fs_context *fc) { struct smb3_fs_context *ctx =3D smb3_fc2context(fc); @@ -1440,6 +1472,8 @@ static int smb3_reconfigure(struct fs_context *fc) if (!rc) rc =3D dfs_cache_remount_fs(cifs_sb); #endif + if (!rc) + smb3_sync_tcon_opts(cifs_sb, cifs_sb->ctx); =20 return rc; =20 --=20 2.43.0 From nobody Sun May 24 20:33:08 2026 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66743348C7B for ; Thu, 21 May 2026 13:54:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371694; cv=none; b=n3hZPv6l4TOtjE6Fv+cBfwaKMYLBMLZxVLKuIPOLBsGzti9s5vxQXyHDa3ybEvwLRVouwaE3joRioqttd9qxllrsfg0SdCaJLlCRl61/wmV2l4XEpMwr+FKTZlkKdUGtkjXiUM4Dc/85AZbI5YUO8T4jPetAvMD7nS9bAjDO7xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371694; c=relaxed/simple; bh=1FqrHpDAtvMFciyscnGdOj53H/dJ7yRt3uoRsX/mHfM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ehE9bMB3CcgEGykQJPANCayi/QLyhNfyfjT5qjvJTmFFgMv+xv8lx58Pm6kuJHhpVeVbCv76u6MHZrY3AGWTubPNHYwsDAOYk+ki1JkKp46tWnQxIbliJmBAFXHt5zr3Uwrmd6C/e/ntwNz6bSDDfyddhjs5vQqcB66ENLV83jA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mhOITMp9; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mhOITMp9" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-c8026aa4d53so4616926a12.3 for ; Thu, 21 May 2026 06:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779371693; x=1779976493; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NEBcGirH2p8qZvg9q6NAt3qPrbqwcSbM2/Hf655L6Fc=; b=mhOITMp9S6fKsWAVQex691uLQ3xaI+YuD5laTwUkJ6OkXnRIRIK6pB5raQb4QfxJ+R MXFQJg9HBZ9vPeOkPfGRImCDo5aexypsmfZMSTjIXHF0PJLsvtvEEeBK1u1P1ka4aika TsJAvcyu2Zu1zp9nnoh7hFugIiy+q1v4Da9akoE4ehZLqk/aChKgr7VPYH8DSaUy8PpA 6kdbQqXmZ2fjyh1PTtC/NdY4tbH3B2ECGRDMD/0W3DLFSk04Q9attN9x10Nh0MQy938Q lF0PqwzsknhB/jro4fQizCrmZDqVwXAdrGJ+k0A5TEGT8p2UQC1r2Zk9wmi5WMd9aY9w hdYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779371693; x=1779976493; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NEBcGirH2p8qZvg9q6NAt3qPrbqwcSbM2/Hf655L6Fc=; b=UrRgFfqQbdbrNAmeOZAgsNwOMxTUztUrFiq5Lbi9iwmU54RBB4r7qcqfKSoFxeTX4h sOK+98DMDP2Q5k7Sunk5L+UTvggxB3lUSu7xoCltftPBlEciHr16lfx6ukNGJTflhliZ TrVZrXhpVRiufFzxs7PPtUxaMBszminHoBSEuBFDiGbtQSue+aiFmGLxdpLeIKvpvxdJ zqC+5dRWkaC3F7W1asJ3k78oXbjkRwYGbHPgl+wd6yVxEGVKRoV5DanD7yRNm8E/qo40 9sJ2W0dAI/FFUw0uTVp1YkSWY+VKI4SUl7sKRHF8bbDL7GUP8BuhGD/D76Tdkr11tQqN pw0g== X-Forwarded-Encrypted: i=1; AFNElJ+EbrWQoo/I2Z9g9TVk6L6o6b+tI1OYIhd2Rezz103mr7t2y9p2H2ilVlrTiAZbuIiRJq/eFeJxmfr6NzM=@vger.kernel.org X-Gm-Message-State: AOJu0YxwI5mxEI9zGHs7HSaco/h6T5YBWDTOnm0gggBslIAP9ljrT85r S8AtN7LiGZ3LVAwSkjKmI/yu1AplZK8+l26OL/dUq98Np7Tz4VbfEsFr X-Gm-Gg: Acq92OH87Cg7TGanP3yQ2x20+2pDVDtVHXjFoD3248qKzm1yKe2MTfdj5NKnYfGmwXO 0KHzpm7GUK2m9akgtojDQsJpghCFjQlm9X5MzGjOJtFr5Yq10GYzBUdBR2e25Q9trqvQR1Mxyw5 XUdPeSwJnTpu48RPjl+CRvYNQ0uTR3upmta0I30QnE+FmT01lBxg1dXZsaYwsTpIK6PCHqwuIUq O3IpKNUCCOKavZIated0BnnKfkyu/ypvW7ZisXO5wqzpw4CLzPTggCdwigwg8EddTSI0B0qJaKk LO5wLnaqn1OOfny6kX++0BI/8TknM849hzXEJUgHTfadzDU47Q+4w3ouvAHDTS4ZbrvxOhnO5Xt 89pk/e9nwvg6gY/52c2013PjIhYsMZa2zAJHYsQzJK/tBfl+LRjNNKyU/1xwwlUluSWE7/3gQ3m 7A+Wg3iXJFhfEk2X+qDKC1AfmKBdOeXHlHgDj7LPAeYVOlCGp4LlvFzOuzyCtHZ706DhuN9v6xJ E3kJyfSKO/M1SqjKsHNx5OqY2p9BC7o8A== X-Received: by 2002:a05:6a21:338c:b0:3a2:dabf:fef9 with SMTP id adf61e73a8af0-3b30878ecf2mr3789760637.27.1779371692780; Thu, 21 May 2026 06:54:52 -0700 (PDT) Received: from dev-vm-rm.hzz4ddxqtfeetjrh00qlbgyytb.rx.internal.cloudapp.net ([20.197.52.255]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c85197c72b3sm455378a12.4.2026.05.21.06.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 06:54:52 -0700 (PDT) From: rajasimandalos@gmail.com To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Meetakshi Setiya Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Rajasi Mandal Subject: [PATCH v3 4/9] smb: client: sync retrans on remount Date: Thu, 21 May 2026 13:54:10 +0000 Message-ID: <1611febb63ba5ac318fcb8b3faa1aa68fcefa873.1779371115.git.rajasimandal@microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rajasi Mandal 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=3D0 because cifs_show_options does not print it) does not accidentally reset the value to zero. Signed-off-by: Rajasi Mandal --- fs/smb/client/fs_context.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index f92c1cb274a6..903b4060d5d0 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1305,6 +1305,23 @@ static void smb3_sync_tcon_opts(struct cifs_sb_info = *cifs_sb, spin_unlock(&cifs_sb->tlink_tree_lock); } =20 +/* + * 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 =3D cifs_sb_master_tcon(cifs_sb)->ses->ser= ver; + struct smb3_fs_context *ctx =3D cifs_sb->ctx; + + spin_lock(&server->srv_lock); + if (ctx->retrans) + server->retrans =3D ctx->retrans; + spin_unlock(&server->srv_lock); +} + static int smb3_reconfigure(struct fs_context *fc) { struct smb3_fs_context *ctx =3D smb3_fc2context(fc); @@ -1474,6 +1491,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); =20 return rc; =20 --=20 2.43.0 From nobody Sun May 24 20:33:08 2026 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07DB33D9693 for ; Thu, 21 May 2026 13:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371698; cv=none; b=vF/4MyRuLPdC9INH2vEo1SvTV6Ttoh/I9rIUhhNiWKasy16DV9q4Ew+O6xmiLNYt0q+YBmmaL83YV7osZRJRYiOR9ve7v2DONFyjYN8spUbvu2ol+FiRwh0PS5QHO+UXQOXp/BYAUPQokwFaAJ+iwnW1wCA6M+/FW5LIxoH9KWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779371698; c=relaxed/simple; bh=xWvLi1yoyODYnbCiHfDSS3dj1D9fHN52L3gXpnsCibM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VNWURO7QKR98EbY6uZNeG/uSOvbFnzw5delrt4xSTiDSn81Zkz3NdThsU3NZw13oNumFTpk9C3dXMBMug3nnyhzItuyh0VapTGujpVGP1o31mhl/ywkHncVMKhpwfNT59CtPZ9xQ/ad8E8w73DEpJyOUuXoqTmvvvJJeVCoBzCU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Rtyz4kvm; arc=none smtp.client-ip=209.85.216.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Rtyz4kvm" Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-3665b67ed66so3955389a91.1 for ; Thu, 21 May 2026 06:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779371696; x=1779976496; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3d46WJ7zTqrz6IjbcLi6dDK5vW5zDJ3cwMKUR6qKmug=; b=Rtyz4kvmPjrfs21gaYwDxc22Ux2t+OcoOFZxogyzCynZW/RdXrtMlxb4jCeF3dED/s EGFWCH2HEsFAf7/Q6BKgNvdDC1F+RIUWnNa1nhzW2hA06bES+GqzZ4Q+fXdDrGXYcz/d eZCQS6nJFER+d9Zf4bzaWduYciImmVvN/zl13+1FQrmBuYeRJNFCCRvk92LALHNzcw/8 F4Ya5Pg8Aa4fy3L7+A/i2gG5WqXNPzcguhQBrZfRvwLY/tiicgyab3k+TcrAgT+AqlwA dNF1Cd9oqGcqVBD8xwRObfQVhsMlbH1Bdf3sx4pe2pRdojn4hKYk2s8AH2rrMZ//G30K Es4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779371696; x=1779976496; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=3d46WJ7zTqrz6IjbcLi6dDK5vW5zDJ3cwMKUR6qKmug=; b=Z9p5eNmJ0hKzO+sHXiv4vrpKEz7/E7DMdVm2jBT37zbW0hJ5hXm9l5cqZuM66dYNOO fue8VbRHtzf4xttxBGwaiZpicp7x4fu+XXSJr0QsVYITBRi4vGUPUz/ynKXlQSFjNrgc 4CDpzW5AnEW5GhIin/kckSwOue8f208C/ndruN0I3Q0U+NiUxa69gXKCwoBiYQXl23Xz P+lIq6DYKidpEFb+WOUK5c129+tKjWTeMpDlJLxjkagSQzN04k7ez17m/rNdPlaT55fB iq6h1kBIIuybiAJjMgoeWmZb8MKOen/QvGEmAmbhNG3vb/JEA+Xs/cgOlrj+GpaHlwEX uYlg== X-Forwarded-Encrypted: i=1; AFNElJ8mIiCLNP8HLW/GniOG7kHEt/FabBB2YDJXS7fQE+O8Wc3RpBRdv0MRNw4eXu0JlFswJZebHEc4sJ9r5BI=@vger.kernel.org X-Gm-Message-State: AOJu0YwklJocVMUS+CmFmt8MaT3En1a8+HdV1qTGpWDsg39Lf7ByD5rF kK8T36+wdFfGJQ4EgroIwXQkZTgmVXgGHlBWOrT7fu5ibDwj7FoXKg3M X-Gm-Gg: Acq92OFZ+Pi69XphjheJP1n26zkx7XpET6kOPxoyvZN4CNGOQE8UptB21fYuPkGxSYX L2JGdfgMJLFcO9jcQkSH6Y7SovaKeyy9jtgS8ivEy5jB5bGqmYadnbjT4TACkP9NVYC7RbmKspW ckC8CgPiCi2D05NV40QEtoQ3kjMZ/9nJjcB3w1URLtdnMBfFvVlPPjSm+/43aBnv2Xc27VcMAUA 2+MFPDipwGiS141CF/dSqpPakvWsaqUxfwciyyYXE4zYQmCEA/w7/2/djKnRnmV9ugdjmz+xxVK m5R3cMJQmWZkP8/4f9/V1utYPqCmzU+g3kTJTc5TVzJ9UIwRsTqmBp91iFbisgKhUxPtJPCPQ+R ueYP4OCnRUBr08WYnxrdgGZ6nbYcceDBjBd+na29nRtXAuxXha6hs51+EeQUQbyz9PFA7QKX4Ov txhby1bY+MUpTAH9lB+c/q4dXdZ1qT/RmJTVjrUzeQkdqBa+KHQqkBsw4ab1oF79TmGE9/0kxMh Z/0mtC8UK3V8/XTRfhoORI= X-Received: by 2002:a17:90a:d644:b0:369:bddb:79bd with SMTP id 98e67ed59e1d1-36a45779371mr3110115a91.25.1779371696234; Thu, 21 May 2026 06:54:56 -0700 (PDT) Received: from dev-vm-rm.hzz4ddxqtfeetjrh00qlbgyytb.rx.internal.cloudapp.net ([20.197.52.255]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c85197c72b3sm455378a12.4.2026.05.21.06.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 06:54:55 -0700 (PDT) From: rajasimandalos@gmail.com To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Meetakshi Setiya Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Rajasi Mandal Subject: [PATCH v3 5/9] smb: client: sync echo_interval on remount Date: Thu, 21 May 2026 13:54:11 +0000 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rajasi Mandal 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 --- 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, =20 /* * 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_inf= o *cifs_sb) spin_lock(&server->srv_lock); if (ctx->retrans) server->retrans =3D ctx->retrans; + if (ctx->echo_interval) + server->echo_interval =3D ctx->echo_interval * HZ; spin_unlock(&server->srv_lock); + + if (ctx->echo_interval) + mod_delayed_work(cifsiod_wq, &server->echo, + server->echo_interval); } =20 static int smb3_reconfigure(struct fs_context *fc) --=20 2.43.0 From nobody Sun May 24 20:33:08 2026 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 452E630BF66 for ; Thu, 21 May 2026 14:06:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779372412; cv=none; b=HjI051HWEtZUQgPG0F0Hi/+BHRodLFv9/NZMp9I3y5OBWSvyLGsc3kHQQbj6Q7TcRGPLYMnluKxHvxehQA978y4Br7NaTnCQnLILs84iCuN4ROjH1ZcoaroFcaMB/aVCRO2655wbekxFqpJnunhudCMhJ0Y/D5iq3+03ZGAwezg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779372412; c=relaxed/simple; bh=MLDfsbrqE/irJ5C5mfSMehDDIzdVCSob1K9JLJJP0Yo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=axEAG4v6U04TRSbr3d8JYODq5/fd5uX0tKl2L7lBYf/n//lnCtng7A2D3TfVRT8YjAxDuoJsnM6ySwl1xjSqb29hGFLKs93fUVMsYaRrI7pF7ij2bFiYoDnuVPQQSpUAk+/Dkztu/cMJFzlyMhRUKxD9GkyicxmmjaqJVI/8U20= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=G/df0SvR; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G/df0SvR" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-83ea84df1d0so1992941b3a.2 for ; Thu, 21 May 2026 07:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779372410; x=1779977210; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lMnwkp3MOEwNeKoTQelUam/C2Jts/WAnmWXL6QUohHk=; b=G/df0SvRSCtrBNrdDoUOHr6Ide6ORx694pxrJx9atCC1Lsg1l2KB9g2qm2hWkz/yI/ 8JgwkU27hyc+DyXqgCOkoe492F/np31tL0UWKOqAtkw1IFHy6RgKsToHNYZiCljLqvLC zpxvBy5Jy4bEy2SEaN7jnBxOBomB69BrXnM+uGlNWuradlL6JPZ7G42EwAHzbeKjWhPq FzOks8hPij3R11wXg42nfvrvpjrbfi4l7gQPTHrG+wjCgC1zBhbNlaEELqmmRjWza4Do ounMTkuZ+8fgl/70kUshNTE2Is+mt2rcd37fmva+g9ytvNh0NLCZRwLwk4FYrOYcGMe3 nXAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779372410; x=1779977210; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=lMnwkp3MOEwNeKoTQelUam/C2Jts/WAnmWXL6QUohHk=; b=PDc6NcxV7BDqs1k2AQf/LzAiD4QZtaTbRffuIJunm0bHNV1A3VIDSFu5WJlHi8BoDd JlxGVQZi/9XSKrqWb0lNHKrToNVmjBKl19NoL9T8oEjc87A3GvfBADwPn4Zw+Mqm5rwl sS8aNn5vbjiFQZILmtjd7gr6OB/m3B5DIP+4XNeVE341i5TDXLXv6dj65g//adPlhCPo wYSWhhposHcM+bfEFdIIOKP1K5T218V09UgizUy+Cxjqihaehnhbc1+lkPUgcqmxXQ7h gA1asdA7If5CyCOzTw3gYgYtnQkk+AvuaZMXo5Unp2oDh0EmHqzMKWik8t/1AEyOYw/B IF9w== X-Forwarded-Encrypted: i=1; AFNElJ9z2pZYMNYH3XfHWOf2RjR26lAPz7i14f1HvH6wXzpucMJ6bevetm32DE3eEorVaI7lGEBnX6ooJpQlM2Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwCI8EYn4npTMm5YcKGbw788kUg9zgdCQsLHD5Iq+9m29ntA6uE iy8jbUWWJvHYwuNJW20tfN26jL8bpT5ZtaV/mefAywi6v1tIaOtTdvbN X-Gm-Gg: Acq92OH7usPgUsiEsjih1byEL+PCb/R9RWMdGJYUZN6Jl1lZukdf4IoBlFCq4i++Not QCia4XIZ9NRD9z1Ey8E3Av6O91/kveeuw33Vg03OcfTn4JUMS4+PA0NLY7DpZeYsAjlwc+0ggnL uidCj23EBIqHl2x+K/krOff45lMULeBF82m4tE4p2qpdia1WvvzSKg9NjzS/8yx7v59bg2ffHap 8woOBstcB8Avq6gHouJXnvId40n993nu+cIDqcofO9+ir3sMlc3GCrSDhkdMQR+c4CJcxn7x4o3 oPg4W82IVE8hsx3fBDOoh3T0E9GGGuCiP2z6OQ0kT57Vt9FGHiJ0X2KSC/q+E6pZspsPFM4btkE iebeOSWkC6JcYEiZU6z6lBQeDddmj3exJEexTLr1Dp4RJkVC7NdECsEaK9Vdsx0AkvamcakiE4q b3IqUz/3OiXUChh/a+wFWMhYgPFDlG9NZQCfEuO/rnVO/mFYB8gcy4CeUSSNuWez22a2Ux9fVXu Udp39TaGlIpjUh7HCwd1Vs= X-Received: by 2002:a05:6a00:3287:b0:83e:f208:b113 with SMTP id d2e1a72fcca58-8414ac62b13mr3306184b3a.7.1779372410574; Thu, 21 May 2026 07:06:50 -0700 (PDT) Received: from dev-vm-rm.hzz4ddxqtfeetjrh00qlbgyytb.rx.internal.cloudapp.net ([20.197.52.255]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-841549c46c9sm1719329b3a.10.2026.05.21.07.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 07:06:50 -0700 (PDT) From: rajasimandalos@gmail.com To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Meetakshi Setiya Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Rajasi Mandal Subject: [PATCH v3 6/9] smb: client: move struct tcon_list to cifsglob.h Date: Thu, 21 May 2026 14:06:41 +0000 Message-ID: <1fd3c3b8f04d7794e559f5caa4ea02ba6e4aa721.1779372325.git.rajasimandal@microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rajasi Mandal struct tcon_list is a small list-node wrapper that pairs a list_head with a cifs_tcon pointer, used to safely iterate tcons under a superblock outside tlink_tree_lock. It is currently file-static in misc.c, used only by cifs_close_all_deferred_files_sb(). Move it next to the similar struct file_list in cifsglob.h so that other _sb() iteration helpers can reuse it instead of redefining the same shape locally. No functional change. Signed-off-by: Rajasi Mandal --- fs/smb/client/cifsglob.h | 5 +++++ fs/smb/client/misc.c | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 82e0adc1dabd..2a8b955638e7 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -1807,6 +1807,11 @@ struct file_list { struct cifsFileInfo *cfile; }; =20 +struct tcon_list { + struct list_head entry; + struct cifs_tcon *tcon; +}; + struct cifs_mount_ctx { struct cifs_sb_info *cifs_sb; struct smb3_fs_context *fs_ctx; diff --git a/fs/smb/client/misc.c b/fs/smb/client/misc.c index 0c54b9b79a2c..7ef135dc8268 100644 --- a/fs/smb/client/misc.c +++ b/fs/smb/client/misc.c @@ -28,11 +28,6 @@ #include "fs_context.h" #include "cached_dir.h" =20 -struct tcon_list { - struct list_head entry; - struct cifs_tcon *tcon; -}; - /* The xid serves as a useful identifier for each incoming vfs request, in a similar way to the mid which is useful to track each sent smb, and CurrentXid can also provide a running counter (although it --=20 2.43.0 From nobody Sun May 24 20:33:08 2026 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF78E3D79E1 for ; Thu, 21 May 2026 14:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779372416; cv=none; b=n/kyidSXYjevMvrYE8v49X64crkcV6H4LWQ5WjhPetWbSM4q+ytKAj5pokHwi04eWcZF13+HxNL1l+24cRG5WEN99n5TWo4elnz2HnCi02G4tQbmJFsMo8lIAyBo52RLeEZMZFdu8jVMzQd2atfNqc3Ps+LszxJdzrEpBizWd+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779372416; c=relaxed/simple; bh=qNvKBCUAVLtNiay7bcRRB4CohpGgHozg5QdXGLiOfVk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g1rCTNhVvTMA4n85zmWrvdIJgkE1dcXbWQrrn+w8XCLS8jF3zI64lJSDKq/yZy/tRS/jcQtcieE1xXZKpmaOtjKEQgPaqcPLR+YuGg6n8GpoRH7DoXLS6NMXOATLaRUuUQ3KOyJUqNxU3NCL4INJYRht+IZavjInCa8DBwzNPXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=a7rRHTSJ; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a7rRHTSJ" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-824c9da9928so2608076b3a.3 for ; Thu, 21 May 2026 07:06:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779372414; x=1779977214; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XUmhfQn5vrV3Pj5ivnNPmEefYLysEFZ1gDRBRlEBFd8=; b=a7rRHTSJ3Np98wKX04xVFiizxKprX34Pq1fqhXyCswRN8avrFlSmB0uV1jdzi8sIcF 2yW47y7GlL2VpEnR1mMP3RCNhuDF80L9X7eAHyPutdmvkP4S+zndiZ0l40r0AN3FtUrH 4kfUZs8eUS+FOymwYF+ThDEizEx7nvMsnbQ/J5+NzTrpg+sVwF1eRXXDgtbc1eB7LsrN vTvl8+9xpnMPWN9KMF6yH2bQZ3AiHTuhy48Cii5T5pavIwM9NzFCzRXPN3y/7lK3ry4+ yoZOTXB462zSOUGg+NxW3jMUEKhb3MlSCXFEnKGT0aaQtvXPsUmL64qpGbyAa8gQL1CP G30Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779372414; x=1779977214; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=XUmhfQn5vrV3Pj5ivnNPmEefYLysEFZ1gDRBRlEBFd8=; b=XMEhEKajYAsVIzfk3YLtfUfIHEL599g/74WG4ZdFI/sJ/3Aoei2IXoXUx3PI27+iAs NwD/vMPmXvNr/stWu7Mli2XNRDEPHfbgO2zsERCCj+MjNz3jKd3bIv04hpwRs08sQjoI DxsEtGXvzx8VS1eeCqlAbSQMIwH+tR2vjOHYJu30ij+hxcuoXtKpSTxJLj4bBHq71WLN pUdkL9EcizJ9pOCynGeCwpzUANJXF7KeyEbYlAM2F1iS3s3p1tTkVHuoUyaO2aLOkWFf bA8UbagygcgUPlAKTwvVfaANQYmBknODdSyWdcR/UrD8XI53oo7sPTbrJoV60qRIyP4C fT3g== X-Forwarded-Encrypted: i=1; AFNElJ/LPKCktV6qX5R/wAuWMRlr0yApE7n2bZ9SA7u9JwBP9NSfssYCUmdJT0vPjyTaYZIdkGjhn+1NLbiR2vQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyNemxzpEyXTi0TbfMuks6MqHcq0wsAl/viAynhRrc9d1TCL2bO N015vxWUgr5BYQTKSXouNT5HkZMjkkgnXj5X88kqiEIN4NmeS9YgmlHr X-Gm-Gg: Acq92OHEJOMvDgSZJCr+oo0OW98LSzIxFaZbuq5oML8F0tNzuhPU/t8priAkkQMc28Z wmnajE9+1IH4KXrxoFUe1PgoH0pND/T8vuaCs13yE976O2vzp38Ggy8XRKAOSt9VTnKNneCrqcj c71b/Qp9LCFluYXFBATPoesyKc4x4fQSR3Uxg0QjntFdSlf02JHcs1ixi22wRjFK3SiblpIkD3j DM9J8qFNUWE3tEV7ymbNrLledwEz6+JaeKwVE7s5oU2lgIrUm0SMb+0dkM+zEZmMKfzxi3DiMul B47Hp8zRVBYUlWvi5qB6rC8bRH3gbpuJY0WC4BZxl+T+46F2WHdJfcikt6O3ZWwW6F0ZRm8WWqS ddjYl+pmJDSz6+529LxJQ7MEPo28IVUHjnfl4K6FsbUWQ2Z6rlcVyayEWN/KGBRwR/A61jEHAu2 EIbamk2rMRE8wdjlMPWF9GUyFrArhl2vTtV9E/49GAFJMMQBMc2oc0IKhskN3GtEQp/G0MjJArs DqUZUhxrZMoO3CJLUW56fo= X-Received: by 2002:a05:6a00:44c7:b0:837:fe75:104e with SMTP id d2e1a72fcca58-8414ac683b2mr3303444b3a.5.1779372414259; Thu, 21 May 2026 07:06:54 -0700 (PDT) Received: from dev-vm-rm.hzz4ddxqtfeetjrh00qlbgyytb.rx.internal.cloudapp.net ([20.197.52.255]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-841549c46c9sm1719329b3a.10.2026.05.21.07.06.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 07:06:53 -0700 (PDT) From: rajasimandalos@gmail.com To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Meetakshi Setiya Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Rajasi Mandal Subject: [PATCH v3 7/9] smb: client: allow nolease option to be reconfigured on remount Date: Thu, 21 May 2026 14:06:42 +0000 Message-ID: <70c810c08e1aecbd4b78103ae3ca5711f9514018.1779372325.git.rajasimandal@microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rajasi Mandal Changing nolease via remount is silently accepted but has no effect: the value is not propagated to the live tcon, and stale lease-bearing state from before the switch keeps using the old behavior. Make nolease take effect on remount: - Propagate ctx->no_lease to tcon->no_lease in smb3_sync_tcon_opts() so future opens honor the new setting. - On switch to nolease, drop deferred file handles via cifs_close_all_deferred_files_sb() (each holds an active lease). - On switch to nolease, evict cached directory fids via the new invalidate_all_cached_dirs_sb() helper (each holds a directory lease). invalidate_all_cached_dirs_sb() mirrors cifs_close_all_deferred_files_sb(): take tc_count refs on every tcon under tlink_tree_lock, drop the lock, then call invalidate_all_cached_dirs() per tcon (it can sleep). Two new tcon_ref trace tags are added for the audit trail. Existing open handles keep their leases until the server breaks them or userspace closes the file -- nolease only governs new opens. Signed-off-by: Rajasi Mandal --- fs/smb/client/cached_dir.c | 44 ++++++++++++++++++++++++++++++++++++++ fs/smb/client/cached_dir.h | 1 + fs/smb/client/fs_context.c | 22 +++++++++++++++++++ fs/smb/client/trace.h | 2 ++ 4 files changed, 69 insertions(+) diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c index 47a51b6b397e..60a483454bf2 100644 --- a/fs/smb/client/cached_dir.c +++ b/fs/smb/client/cached_dir.c @@ -637,6 +637,50 @@ void invalidate_all_cached_dirs(struct cifs_tcon *tcon= , bool sync) flush_delayed_work(&cfids->laundromat_work); } =20 +/* + * Invalidate cached directory entries across all tcons under a + * superblock. Collect references on each tcon under tlink_tree_lock, + * then call invalidate_all_cached_dirs() outside the spinlock since it + * can sleep. Holding a tc_count reference prevents the tcon from being + * freed by tlink_expire_delayed() between dropping the spinlock and + * the call. + */ +void invalidate_all_cached_dirs_sb(struct cifs_sb_info *cifs_sb) +{ + struct rb_root *root =3D &cifs_sb->tlink_tree; + struct rb_node *node; + struct cifs_tcon *tcon; + struct tcon_link *tlink; + struct tcon_list *tmp_list, *q; + LIST_HEAD(tcon_head); + + spin_lock(&cifs_sb->tlink_tree_lock); + for (node =3D rb_first(root); node; node =3D rb_next(node)) { + tlink =3D rb_entry(node, struct tcon_link, tl_rbnode); + tcon =3D tlink_tcon(tlink); + if (IS_ERR(tcon)) + continue; + tmp_list =3D kmalloc_obj(struct tcon_list, GFP_ATOMIC); + if (!tmp_list) + break; + tmp_list->tcon =3D tcon; + spin_lock(&tcon->tc_lock); + ++tcon->tc_count; + trace_smb3_tcon_ref(tcon->debug_id, tcon->tc_count, + netfs_trace_tcon_ref_get_cached_inval_sb); + spin_unlock(&tcon->tc_lock); + list_add_tail(&tmp_list->entry, &tcon_head); + } + spin_unlock(&cifs_sb->tlink_tree_lock); + + list_for_each_entry_safe(tmp_list, q, &tcon_head, entry) { + invalidate_all_cached_dirs(tmp_list->tcon, true); + list_del(&tmp_list->entry); + cifs_put_tcon(tmp_list->tcon, netfs_trace_tcon_ref_put_cached_inval_sb); + kfree(tmp_list); + } +} + static void cached_dir_offload_close(struct work_struct *work) { diff --git a/fs/smb/client/cached_dir.h b/fs/smb/client/cached_dir.h index fc756836da95..606ba2a0b64f 100644 --- a/fs/smb/client/cached_dir.h +++ b/fs/smb/client/cached_dir.h @@ -90,6 +90,7 @@ void close_cached_dir(struct cached_fid *cfid); void drop_cached_dir_by_name(const unsigned int xid, struct cifs_tcon *tco= n, const char *name, struct cifs_sb_info *cifs_sb); void close_all_cached_dirs(struct cifs_sb_info *cifs_sb); +void invalidate_all_cached_dirs_sb(struct cifs_sb_info *cifs_sb); void invalidate_all_cached_dirs(struct cifs_tcon *tcon, bool sync); bool cached_dir_lease_break(struct cifs_tcon *tcon, __u8 lease_key[16]); =20 diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index f09ad5d470f3..7164dda715ca 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -35,6 +35,7 @@ #include "nterr.h" #include "rfc1002pdu.h" #include "fs_context.h" +#include "cached_dir.h" =20 DEFINE_MUTEX(cifs_mount_mutex); =20 @@ -1295,6 +1296,7 @@ static void smb3_sync_tcon_opts(struct cifs_sb_info *= cifs_sb, =20 spin_lock(&tcon->tc_lock); tcon->retry =3D ctx->retry; + tcon->no_lease =3D ctx->no_lease; /* * Note: this updates the limit for new cached dir opens * but does not resize or evict existing cached dirents. @@ -1303,6 +1305,26 @@ static void smb3_sync_tcon_opts(struct cifs_sb_info = *cifs_sb, spin_unlock(&tcon->tc_lock); } spin_unlock(&cifs_sb->tlink_tree_lock); + + /* + * When switching to nolease, close deferred file handles and + * invalidate cached directory entries. Both hold leases from + * before the switch; without cleaning them up, those handles + * continue using lease-based caching despite nolease being set. + * + * Note: files already open with leases (e.g. RWH) by applications + * are not affected -- nolease only governs new opens. Existing + * handles retain their leases until the server sends a lease break + * or the application closes the handle. + * + * Both _sb() helpers iterate all tcons internally and handle + * their own locking. They can sleep, so they must be called + * outside tlink_tree_lock. + */ + if (ctx->no_lease) { + cifs_close_all_deferred_files_sb(cifs_sb); + invalidate_all_cached_dirs_sb(cifs_sb); + } } =20 /* diff --git a/fs/smb/client/trace.h b/fs/smb/client/trace.h index 5b21ad3c15fb..1e61a36759ed 100644 --- a/fs/smb/client/trace.h +++ b/fs/smb/client/trace.h @@ -173,6 +173,7 @@ EM(netfs_trace_tcon_ref_free_ipc, "FRE Ipc ") \ EM(netfs_trace_tcon_ref_free_ipc_fail, "FRE Ipc-F ") \ EM(netfs_trace_tcon_ref_free_reconnect_server, "FRE Reconn") \ + EM(netfs_trace_tcon_ref_get_cached_inval_sb, "GET Ch-IvS") \ EM(netfs_trace_tcon_ref_get_cached_laundromat, "GET Ch-Lau") \ EM(netfs_trace_tcon_ref_get_cached_lease_break, "GET Ch-Lea") \ EM(netfs_trace_tcon_ref_get_cancelled_close, "GET Cn-Cls") \ @@ -186,6 +187,7 @@ EM(netfs_trace_tcon_ref_new_ipc, "NEW Ipc ") \ EM(netfs_trace_tcon_ref_new_reconnect_server, "NEW Reconn") \ EM(netfs_trace_tcon_ref_put_cached_close, "PUT Ch-Cls") \ + EM(netfs_trace_tcon_ref_put_cached_inval_sb, "PUT Ch-IvS") \ EM(netfs_trace_tcon_ref_put_cancelled_close, "PUT Cn-Cls") \ EM(netfs_trace_tcon_ref_put_cancelled_close_fid, "PUT Cn-Fid") \ EM(netfs_trace_tcon_ref_put_cancelled_mid, "PUT Cn-Mid") \ --=20 2.43.0 From nobody Sun May 24 20:33:08 2026 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 663C63E16A6 for ; Thu, 21 May 2026 14:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779372419; cv=none; b=IEb7ayQNwKELjJTtv0oHc8NAFS/0EFcCuDVgx4KXmNLuDNubnf5+LQR09p7sqbUB6kzG4z8ryT6LXgazGmi+MI7TxcXmzLPsrchyWUt+3KwtJnunzA8fSpNhwJdMsxQdN8kw5M+jWfgcdvoz1gBpcOE/P5dePGenXa5h9FH3Y6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779372419; c=relaxed/simple; bh=MF3jr+TWwaU4aFfScYUQqUoq7VamaH9MJ97TeazV8yY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=th2gVWcVjstACnndftbrvM+P2feFUJszZKEmDv9m5T1AyqPsEh/mYsKwk+MqUBS9GUUU4PdEHgqchDuX01wR8k8K9qzyfJP6QVAqkSQRgOAKbNUNc1RYV7Wz/j7EtEnBvUbwDlCAgNyabEiznnR7I5VZmc4TJspuC7LdzA9mMMU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dX6511lY; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dX6511lY" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-82f9fdfc965so2805147b3a.1 for ; Thu, 21 May 2026 07:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779372418; x=1779977218; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oo+sNkiQm6M5U0eLy+pOSJt6ZqbnkZ2OxN5h3YWrjCA=; b=dX6511lYOlAhkT980GQrvHfw/99Xzu/jYXbtsFEDuv1m6hvUjiECnJKI+o+yBFKCQ6 dzeY/zguhIuBv57urFSYX5ffTbOLXYr/fiq7asamI3QZI6dZkNW2Z68gqwKejLXJk3bT L9+an8yfnodGcJLShAHGMfcAPUOghTRfFNfH1uLBmyCEctcPmVymuG9UIh062NpjQvFo svwztDD8UUd9X1DnEwLHUZUMJ86tr/SgxSfLnVNBEdnSdsKvJpbDmpKqv2DHjXRvs8Yt fKFuEdcRDcL0HNaoqMZS4JcYpDOPxo+ZKar8jfkXSYdXCoCyQmagYINJhTu2Amxs6wNG 4KWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779372418; x=1779977218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=oo+sNkiQm6M5U0eLy+pOSJt6ZqbnkZ2OxN5h3YWrjCA=; b=UZ20Prra8cbzmfrwpIv55mNzsMQogOhfX301JOokIsRbBH339ylyqmzvbaqW0NSIAS +VKSyEj8l3VIQYw0i2o5mm7ZPcCyW8WjW769hJoLFxm8upQS5Lz1xFltY6XdwmHcQzcV Sut2m25wU9zg7GIgil3muB3dSufIyJFVrsSrSQ9Gi8YyORg5ArX//s5OOYv/N3rnf8h7 5Ifr5vCgQTkP7sg2lJuIsn0utBFzyIevt593dXXjvCU9hNo5ak9BYaHv7KkIL75DBunK lj1eMXHQAoKkTE3aFUrw/6SlJVr+AkTgPmSdJJ2lXkTdCy/kwOZHN4qPe6Myvuk07Tan b56Q== X-Forwarded-Encrypted: i=1; AFNElJ8hU8rlVw+XqKSbkJuL6fr4xd0YuDLemmZPIg9dF/hrrdz7h6t7vvwIkX8SbIHY8aK7blBVCEuPYNXnVKQ=@vger.kernel.org X-Gm-Message-State: AOJu0YycNhiPuehl14FnvnWYgiTwqIn7mLKvCZD3ade/lNq5lgPHmKPx ++1FV0F8kro5205fqIl6YxP33dOB8pbOjS3VHOL27kSVLwSIIsP2NcU/ X-Gm-Gg: Acq92OEmCVc2iD+rs3VE9/ME+58pLOzkKjXyPoayS1YE973p/3C41zZRT8wYuXA4Bsq +3e7+mGyorq02wAxrHj1q2ppnPJCMFp7z0Y12w+pS1do6X97GP7CqA0vTQicjreGfIMYcNjAZJ3 SVrv5M95ZazrqgWl2g7GtpuFtENrMZoJbV+SbAY8dAZ9twRyyjgQW2Ms+qMf5XaJPoVpj0EeLRK S2q3JluuaxwnxxlR6IcfOD4QSmjHeMWgchwyPMQdd6HY+s7L8XFiYTziu9fB5HcI+apXlZ4FB5+ IMYSbcOyZV/Usm4tITQHhFZjAcFqda6hhKIVlTdGplB+f6j1Aovi2stHKonWwLFAvBgZYvow32i tmapzPtkF4VTd+CRdHaJETGlSoBNK84zwE3y6fVAWE9ImyUfov6AQsSa0Qidk9r8zqjVJDunSpF h3EZaGqQ2fJah+WOv/EYeojMOz3xinJrfcNJMRBfw7hnxqmKnNG7FB9DwdLUyHDyboTm9sBW/bU ZbvXLTmq7Vq38IhYsiAmVM= X-Received: by 2002:a05:6a00:908c:b0:829:8a84:b9fc with SMTP id d2e1a72fcca58-8414ac6afb5mr3761635b3a.8.1779372417733; Thu, 21 May 2026 07:06:57 -0700 (PDT) Received: from dev-vm-rm.hzz4ddxqtfeetjrh00qlbgyytb.rx.internal.cloudapp.net ([20.197.52.255]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-841549c46c9sm1719329b3a.10.2026.05.21.07.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 07:06:57 -0700 (PDT) From: rajasimandalos@gmail.com To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Meetakshi Setiya Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Rajasi Mandal Subject: [PATCH v3 8/9] smb: client: block cache=ro and cache=singleclient on remount Date: Thu, 21 May 2026 14:06:43 +0000 Message-ID: <60af8bbbdb78caa38a46df07300d34e16112f396.1779372325.git.rajasimandal@microsoft.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Rajasi Mandal cache=3Dro and cache=3Dsingleclient are mount-time environment declarations where the admin promises that the share is read-only or exclusively accessed. The client bypasses server-based coherency (oplocks/leases) and caches aggressively based on this promise. These modes were intentionally excluded from smb3_update_mnt_flags() when it was introduced in commit 2d39f50c2b15 ("cifs: move update of flags into a separate function") =E2=80=94 only cache=3Dstrict, cache=3Dnon= e and cache=3Dloose were made reconfigurable. However, remount currently silently accepts cache=3Dro and cache=3Dsingleclient without actually applying them, which is confusing. Add explicit checks in smb3_verify_reconfigure_ctx() to reject attempts to change these options during remount with a clear error message. Signed-off-by: Rajasi Mandal --- fs/smb/client/fs_context.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 7164dda715ca..0ef8ccd53882 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1207,6 +1207,15 @@ static int smb3_verify_reconfigure_ctx(struct fs_con= text *fc, cifs_errorf(fc, "can not change rdma during remount\n"); return -EINVAL; } + /* init default: cache_ro =3D false, cache_rw =3D false (i.e. cache=3Dstr= ict) */ + if (new_ctx->cache_ro !=3D old_ctx->cache_ro) { + cifs_errorf(fc, "can not change cache=3Dro during remount\n"); + return -EINVAL; + } + if (new_ctx->cache_rw !=3D old_ctx->cache_rw) { + cifs_errorf(fc, "can not change cache=3Dsingleclient during remount\n"); + return -EINVAL; + } =20 return 0; } --=20 2.43.0 From nobody Sun May 24 20:33:08 2026 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06D3C3E316F for ; Thu, 21 May 2026 14:07:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779372425; cv=none; b=efOan4ybSM1BWi0QYXNaY17AgPr/+V+CFhH2FxJ4TflGtBaoZucpMPCnGsAjbroPDEuNVsb16XDXwEpp4kq59BWWEPLif91Q1AK00jkfSRDJAgOF4NCagsoKBUYDS3lS+gF1LemfgfbZREynGKKAz8lQ0yj/Pb/jmrnFNPQ6eNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779372425; c=relaxed/simple; bh=1T8l8REmilfpCPHOBhjUy6PoNfGlv7+n54N3fM8ecbM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U/N5WnWfYwuImedMR/i4Catrte0L5epjVeqqwBCs0CcP6B5QVjyPmh/zGwubjPlk9YiH00y7AGrs+neXQm/N8Y1wTyFSJk4tQJUFNh5RwgXdXaFqTtJ8b+/ZXtOoMvPbQszR8UCsuvg9VX3f0lUTu/ogERnxX+VfENsGAuN18tE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iplaEYue; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iplaEYue" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-8413ac3d82fso1453267b3a.0 for ; Thu, 21 May 2026 07:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779372422; x=1779977222; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=i8rn7+Tny7SXBXyjHw4bmnyLQ4nAf+a0iRkwkUyY9z4=; b=iplaEYue2QRXiWHOeCLjxMulL0AoefsZOORc01ljTRLUb3rUb1d3A6bKYJoNZ07t6W 20II1RF29TOYEO+UpOBHE3wlzQfauRG4vwYiwhkUxTys4qtGuGzXGWV+TFD916nQr+ik 8eHw8lQg9v11VnK9lT7YO+ZnynN5fw14qj+G+RpkBFLp/xWddzXTN4vQUcYynHTwMUKB McjhyiwRw1hPJQJ+/F8b/ZALc0YobI/IigB3w+98ymoJwBIiq5BsVu96FI1YwoUBWdEv aHgKD3LEEgmqqr+azvymxu6TNeigRUzzTrI1JmX0GUVLEKktdQu/L6cj6NSWDzGGQlle xKOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779372422; x=1779977222; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=i8rn7+Tny7SXBXyjHw4bmnyLQ4nAf+a0iRkwkUyY9z4=; b=EeT5waOUSVrxj+xLg+I+ZP1ZQuk6ueDVDC7tY8tIPywp8xKRBLreIiIInfsTHNcjWe aBh+3nhuLBvGlt7qPf4BLWdg6UCcfyzp8p6dBGM/sanBNqbHLYh/XowmSTkIdGIgBUvM djGfEKBiYtVldV6EVc8S7ERjjyt9Un8mKpAJSzU5kRzRH3/dCAhtry1mBAzsgR05haRL 7ep6PCSGlWThrQanh01SXT3CXwkCZdBMjKKcSCIf1pS213zc8oA5q23HonfkGzGQ6cIv hVJ4P67GK44aHDqe8JgG8EoUwaSUHX1oBdmqXvOTkS7DGCqN0IVDT7rTCBLuhrIMscvm Psow== X-Forwarded-Encrypted: i=1; AFNElJ8avFe3pJ3MhnLx3v0L54AHEJ+tV9/LsCLjihW97aIsXR0ZsyJv65G6YoOV6YEIAXEa3dDbdo/j3tOCX00=@vger.kernel.org X-Gm-Message-State: AOJu0Yys24jUeTLdKyk/koetfwy0OgIaWnff9hAliKE12ekLwTA4aDpd SjwVCsdy4jKRwrWNlsvAbvs9ZNpoGbvtoRNJlRn7FdcHj1MPtxr8F+eh X-Gm-Gg: Acq92OHGsEVgR66x80ikkpfHUFwDqzUPTwnDDJLWBw9avmAGva2uMTXTxr8NxJTHVts ErFupzKdDHcJbqhe09N4+b7dzcD7KQbgam0gt/xyA3Jzs0q5naudsRAaoglw1VcpAVnUZmV8gOw PAGHF4kONCMBrEsCM9jsv8RVX2CsXH+CIC4TOO/ANJIyz+9dRctgOP6YLkQoVMn/D8bzkLz89ZO bGL5/nsA4/HA10LksDEzMIweF/KR0eoRJJpz5LTVCkfd6U91qU98qvap9dmcur/GSj5uylMXF0F fFPV2B5RCNmreNvpkAgeNTcuq2a2FATLAHc76BKVxA/dJ88PEqsJocnYdTcYiF+T2nwukrq8oFl etqjNeSGyljB37Rfn8JsQ8zZPyJIxo5yN6u1gngiF6kmMGu40miKzV7KdyK/U52sRrLs5BkfQsU hFg6Psac0NPKuSbVRh8I4txP9gGJiOAhA4D0a4iIQYtnk605uLglCmK/razsb35M1ZSasxCPDXP j3KALvM6Ow0Oq/YEGfk+do= X-Received: by 2002:a05:6a00:3c85:b0:839:f1c0:13ce with SMTP id d2e1a72fcca58-8414ae69ebfmr3361708b3a.40.1779372422159; Thu, 21 May 2026 07:07:02 -0700 (PDT) Received: from dev-vm-rm.hzz4ddxqtfeetjrh00qlbgyytb.rx.internal.cloudapp.net ([20.197.52.255]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-841549c46c9sm1719329b3a.10.2026.05.21.07.06.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 07:07:00 -0700 (PDT) From: rajasimandalos@gmail.com To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey , Bharath SM , Meetakshi Setiya Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, Rajasi Mandal Subject: [PATCH v3 9/9] smb: client: apply rasize on remount Date: Thu, 21 May 2026 14:06:44 +0000 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rajasi Mandal rasize is accepted during remount parsing but sb->s_bdi->ra_pages is only set in cifs_read_super() at mount time. A remount with a new rasize value silently has no effect on the readahead window. Update ra_pages in smb3_reconfigure() after the context has been duplicated, using the same logic as cifs_read_super(): if rasize is set, use it directly; otherwise fall back to 2 * rsize. Signed-off-by: Rajasi Mandal --- fs/smb/client/fs_context.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c index 0ef8ccd53882..1b42af418f77 100644 --- a/fs/smb/client/fs_context.c +++ b/fs/smb/client/fs_context.c @@ -1367,7 +1367,7 @@ static int smb3_reconfigure(struct fs_context *fc) struct dentry *root =3D fc->root; struct cifs_sb_info *cifs_sb =3D CIFS_SB(root->d_sb); struct cifs_ses *ses =3D cifs_sb_master_tcon(cifs_sb)->ses; - unsigned int rsize =3D ctx->rsize, wsize =3D ctx->wsize; + unsigned int rsize =3D ctx->rsize, wsize =3D ctx->wsize, rasize =3D ctx->= rasize; char *new_password =3D NULL, *new_password2 =3D NULL; bool need_recon =3D false; bool need_mchan_update; @@ -1431,9 +1431,10 @@ static int smb3_reconfigure(struct fs_context *fc) STEAL_STRING_SENSITIVE(cifs_sb, ctx, password2); } =20 - /* if rsize or wsize not passed in on remount, use previous values */ + /* if rsize, wsize, or rasize not passed in on remount, use previous valu= es */ ctx->rsize =3D rsize ? CIFS_ALIGN_RSIZE(fc, rsize) : cifs_sb->ctx->rsize; ctx->wsize =3D wsize ? CIFS_ALIGN_WSIZE(fc, wsize) : cifs_sb->ctx->wsize; + ctx->rasize =3D rasize ? rasize : cifs_sb->ctx->rasize; =20 new_ctx =3D kzalloc_obj(*new_ctx); if (!new_ctx) { @@ -1522,6 +1523,12 @@ static int smb3_reconfigure(struct fs_context *fc) smb3_cleanup_fs_context(old_ctx); old_ctx =3D NULL; smb3_update_mnt_flags(cifs_sb); + + if (cifs_sb->ctx->rasize) + root->d_sb->s_bdi->ra_pages =3D cifs_sb->ctx->rasize / PAGE_SIZE; + else + root->d_sb->s_bdi->ra_pages =3D 2 * (cifs_sb->ctx->rsize / PAGE_SIZE); + #ifdef CONFIG_CIFS_DFS_UPCALL if (!rc) rc =3D dfs_cache_remount_fs(cifs_sb); --=20 2.43.0