[PATCH v3 0/9] smb: client: make remount option handling correct and consistent

rajasimandalos@gmail.com posted 9 patches 3 days, 5 hours ago
fs/smb/client/cached_dir.c |  44 +++++
fs/smb/client/cached_dir.h |   1 +
fs/smb/client/cifs_swn.h   |  14 +-
fs/smb/client/cifsglob.h   |   5 +
fs/smb/client/fs_context.c | 355 ++++++++++++++++++++++++++++++++++++-
fs/smb/client/misc.c       |   5 -
fs/smb/client/smb1ops.c    |   7 +-
fs/smb/client/smb2pdu.c    |  11 +-
fs/smb/client/trace.h      |   2 +
9 files changed, 431 insertions(+), 13 deletions(-)
[PATCH v3 0/9] smb: client: make remount option handling correct and consistent
Posted by rajasimandalos@gmail.com 3 days, 5 hours ago
From: Rajasi Mandal <rajasimandal@microsoft.com>

This series fixes several long-standing problems with how the SMB
client handles mount options at remount time:

  - Options that affect runtime behaviour were silently ignored on
    remount because smb3_reconfigure() only updated cifs_sb->ctx and
    never propagated the new values to the live tcon / TCP_Server_Info
    structures (retrans, echo_interval, the per-tcon options, rasize).

  - Options that have no meaningful semantics on a live mount were
    accepted by the parser, leading to confusing behaviour where the
    user thinks the change took effect (vers, sec, multiuser, UNC,
    username, ...).  These are now rejected with a clear error.

  - Toggling 'lease' / 'nolease' on remount used to leave behind
    deferred file handles and cached directory entries that were
    obtained under the previous lease setting.  This series closes
    deferred files and invalidates cached dirs across the superblock
    when transitioning to nolease.

  - cache=ro and cache=singleclient are special-cased to be rejected
    on remount because changing them at runtime would be unsafe.

Patch 5 is a small refactor that moves struct tcon_list out of misc.c
into cifsglob.h so it can be shared between the new
invalidate_all_cached_dirs_sb() helper in cached_dir.c and the
existing cifs_close_all_deferred_files_sb() in misc.c.  Patch 6 then
uses the shared struct.

Testing
=======

  - Ran xfstests on the patch series.
  - A targeted nolease/cached_dir stress test (lease<->nolease toggle
    cycles, parallel remounters, concurrent I/O, GET/PUT trace pairing,
    deadlock/starvation bounds, hung-task scan).
  - A general remount test covering both reconfigurable and rejected
    option changes plus repeated mount/umount/remount cycles.

All runs clean, no WARN/BUG/UAF/hung-task in dmesg.


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

 fs/smb/client/cached_dir.c |  44 +++++
 fs/smb/client/cached_dir.h |   1 +
 fs/smb/client/cifs_swn.h   |  14 +-
 fs/smb/client/cifsglob.h   |   5 +
 fs/smb/client/fs_context.c | 355 ++++++++++++++++++++++++++++++++++++-
 fs/smb/client/misc.c       |   5 -
 fs/smb/client/smb1ops.c    |   7 +-
 fs/smb/client/smb2pdu.c    |  11 +-
 fs/smb/client/trace.h      |   2 +
 9 files changed, 431 insertions(+), 13 deletions(-)


base-commit: 19d8c94787da866318eead464fb9c9d70815af56
-- 
2.43.0