Re: [PATCH 7/9] smb: client: block cache=ro and cache=singleclient on remount
RAJASI MANDAL <[email protected]> Tue, 21 Apr 2026 21:34:45 -0700
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.cifs,gmane.network.samba.internals |
|---|---|
| Message-ID | <CAEY6_V3SEV-38f6q3BgA1OnX36yLSkJvir1yxTL_M2fhr2qx4g@mail.gmail.com> |
Handled in updated Patch 1 On Mon, Apr 13, 2026 at 7:10 PM Meetakshi Setiya <[email protected]> wrote: > > Hey Rajasi, > > I guess this is not handling remounts where cache=singleclient/ro is > not specified i.e. preserving previous behaviour. > > To reproduce, mount with cache=ro and remount without providing cache=ro. > > sudo mount -t cifs //server/winshare /mnt/mainshare -o > remount,username=demouser > mount error(22): Invalid argument > > On Thu, Apr 9, 2026 at 3:07 AM <[email protected]> wrote: > > > > From: Rajasi Mandal <[email protected]> > > > > cache=ro and cache=singleclient 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") — only cache=strict, cache=none and > > cache=loose were made reconfigurable. However, remount currently > > silently accepts cache=ro and cache=singleclient 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 <[email protected]> > > --- > > fs/smb/client/fs_context.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c > > index ce4842e778c4..2be72733ef2e 100644 > > --- a/fs/smb/client/fs_context.c > > +++ b/fs/smb/client/fs_context.c > > @@ -1180,6 +1180,14 @@ static int smb3_verify_reconfigure_ctx(struct fs_context *fc, > > cifs_errorf(fc, "can not change rdma during remount\n"); > > return -EINVAL; > > } > > + if (new_ctx->cache_ro != old_ctx->cache_ro) { > > + cifs_errorf(fc, "can not change cache=ro during remount\n"); > > + return -EINVAL; > > + } > > + if (new_ctx->cache_rw != old_ctx->cache_rw) { > > + cifs_errorf(fc, "can not change cache=singleclient during remount\n"); > > + return -EINVAL; > > + } > > > > return 0; > > } > > -- > > 2.43.0 > > > >