[PATCH 0/7] smb: client: remount reconfigure option fixes

[email protected]
Newsgroups org.kernel.vger.linux-cifs
Message-ID <[email protected]>
From: Rajasi Mandal <[email protected]>

This series makes several mount options actually take effect (or be
cleanly rejected) on remount instead of being silently ignored, and
fixes the option-comparison baseline so a bare 'mount -o remount' is
neither wrongly rejected nor allowed to clobber live runtime state.

Overview:
  1: build the reconfigure baseline from the live mount (a private,
     runtime-synced dup of cifs_sb->ctx) instead of init defaults.
  2: reject connection-tied options that cannot change on remount,
     using that baseline so bare remounts and /proc/mounts replays
     are still accepted.
  3: propagate retrans to the live server on remount.
  4: reject cache=ro / cache=singleclient changes on remount.
  5: apply rasize on remount.
  6: move struct tcon_list to cifsglob.h (no functional change).
  7: make nolease take effect on remount and evict lease-bearing
     cached state.

Changes since the previous posting ("[PATCH RESEND 0/9]"):
  - Folded the two "review fixes" commits into the patches they fix;
    the series is now 7 self-contained, bisectable patches.
  - Patch 1: do not fabricate no_linux_ext (mirrors the existing
    nopersistent handling); sync the server-shared display fields into
    the baseline so a bare remount on a shared connection is not
    wrongly rejected.
  - Patch 7: invalidate_all_cached_dirs_sb() counts tcons and
    allocates with GFP_KERNEL outside tlink_tree_lock instead of a
    per-tcon GFP_ATOMIC allocation that could fail mid-walk.

Known pre-existing issues intentionally NOT addressed here (each is
called out in the relevant commit message):
  - cifs_sb->ctx is read locklessly while smb3_reconfigure() overwrites
    it in-place, so a /proc/mounts read racing a remount of the same
    mount can observe a torn pointer.  This predates the series; the
    proper fix (RCU-style ctx replacement) is left as its own change.
    (Patch 1)
  - tcon->unix_ext shares a bitfield word with other lockless writers;
    theoretical word-tearing only.  (Patch 1)
  - Explicit 'mount -o remount,port=<active-default>' is rejected; not
    reachable via tooling since port is not in /proc/mounts.  (Patch 2)
  - cached_dir_lease_break() updates tcon->tc_count without tc_lock;
    cfids_laundromat_worker() can resurrect a tcon from tc_count 0
    while cifs_put_tcon() tears it down; and the cifs_debug dirs knob
    invalidates with close_handles=false.  All pre-existing and
    unrelated to nolease.  (Patch 7)

Testing:
  - checkpatch --strict clean (bar one pre-existing CamelCase CHECK on
    ses->domainName); each patch builds standalone (bisectable).
  - Functional testing on Azure Files (SMB 3.1.1): a bare remount
    preserves the full /proc/mounts option set; retrans/nolease/rasize
    apply on remount; vers / echo_interval and other non-reconfigurable
    changes are rejected with -EINVAL; a remount replaying a
    server-displayed option is accepted; I/O works and dmesg is clean.

Rajasi Mandal (7):
  smb: client: sync runtime state into ctx on reconfigure
  smb: client: block non-reconfigurable option changes on remount
  smb: client: sync retrans on remount
  smb: client: block cache=ro and cache=singleclient on remount
  smb: client: apply rasize on remount
  smb: client: move struct tcon_list to cifsglob.h
  smb: client: allow nolease option to be reconfigured on remount

 fs/smb/client/cached_dir.c |  83 ++++++-
 fs/smb/client/cached_dir.h |   4 +-
 fs/smb/client/cifs_debug.c |   2 +-
 fs/smb/client/cifs_swn.h   |  14 +-
 fs/smb/client/cifsfs.c     |   6 +-
 fs/smb/client/cifsglob.h   |   7 +-
 fs/smb/client/connect.c    |   4 +-
 fs/smb/client/file.c       |   2 +-
 fs/smb/client/fs_context.c | 446 ++++++++++++++++++++++++++++++++++++-
 fs/smb/client/misc.c       |   5 -
 fs/smb/client/smb1ops.c    |   7 +-
 fs/smb/client/smb2ops.c    |   2 +-
 fs/smb/client/smb2pdu.c    |  13 +-
 fs/smb/client/trace.h      |   2 +
 14 files changed, 567 insertions(+), 30 deletions(-)


base-commit: c0a27675eaf08255017b3cabc28c99c0cd71f468
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.