Linux-CIFS Archive mirror
 help / color / mirror / Atom feed
From: Steve French <smfrench@gmail.com>
To: Bharath SM <bharathsm.hsk@gmail.com>
Cc: rajasimandalos@gmail.com, sfrench@samba.org,
	linux-cifs@vger.kernel.org,
	 Rajasi Mandal <rajasimandal@microsoft.com>
Subject: Re: [PATCH v2] smb: client: allow nolease option to be reconfigured on remount
Date: Wed, 22 Apr 2026 10:29:12 -0500	[thread overview]
Message-ID: <CAH2r5msBOKixrOyyeEt4Es6W3eABVFMx2iwMcRakiRvD6fYatA@mail.gmail.com> (raw)
In-Reply-To: <CAGypqWz-rThJ3SaeJECy9mG3e+CCmozkns5k3UyatdVuXSonjw@mail.gmail.com>

On Wed, Apr 22, 2026 at 3:37 AM Bharath SM <bharathsm.hsk@gmail.com> wrote:
>
> On Tue, Apr 21, 2026 at 10:06 PM <rajasimandalos@gmail.com> wrote:
> >
> > From: Rajasi Mandal <rajasimandal@microsoft.com>
> >
> > tcon->no_lease controls whether the client requests leases from the
> > server.  Changing nolease via remount is silently accepted but has
> > no effect because the value is never propagated to the live tcon.
> >
> > Add no_lease to smb3_sync_tcon_opts() so the flag is propagated to
> > every tcon on remount.
> >
> > When switching to nolease, close all deferred file handles via
> > cifs_close_all_deferred_files_sb() outside the tlink_tree_lock,
> > since closing deferred handles can sleep.  Deferred handles retain
> > active leases from before the switch; without closing them, those
> > files continue using lease-based caching despite nolease being set.
> >
> > Both transitions are safe:
> >  - lease -> nolease: deferred handles are closed, future opens
> >    get OPLOCK_LEVEL_NONE.
> >  - nolease -> lease: future opens request leases normally.
> >
> > Signed-off-by: Rajasi Mandal <rajasimandal@microsoft.com>
> > ---
> >  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 45173f287f00..fb59b45c7f66 100644
> > --- a/fs/smb/client/fs_context.c
> > +++ b/fs/smb/client/fs_context.c
> > @@ -1317,6 +1317,7 @@ static void smb3_sync_tcon_opts(struct cifs_sb_info *cifs_sb,
> >
> >                 spin_lock(&tcon->tc_lock);
> >                 tcon->retry = ctx->retry;
> > +               tcon->no_lease = ctx->no_lease;
> >                 /*
> >                  * Note: this updates the limit for new cached dir opens
> >                  * but does not resize or evict existing cached dirents.
> > @@ -1325,6 +1326,14 @@ 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 all deferred file handles.
> > +        * cifs_close_all_deferred_files_sb() handles its own locking
> > +        * and must be called outside tlink_tree_lock since it can sleep.
> > +        */
> > +       if (ctx->no_lease)
> > +               cifs_close_all_deferred_files_sb(cifs_sb);
> >  }
> Similar to deferred files, I think we probably need to invalidate the
> cached directory
> entries when we remount with 'nolease' considering 'nolease' is a
> superset mount option
> and should affect all types of leases.
>
> One additional case to consider: if an application already has a file
> open with an RWH
> lease acquired before the remount, that handle may continue to hold
> its lease and benefit
> from caching until the server sends a lease break or the application
> closes the handle.
> Is that correct.?
> I think nolease remount only affects new opens; it cannot
> retroactively revoke leases on
> existing active file handles. It may be worth documenting and/or
> comment this behavior,
> so it's clear that lease->nolease takes effect gradually as old
> handles are closed rather than
> instantaneously across all files & handles.
>
> Other than these comments, change looks good to me.

Should those changes be in followon patch rather than adding to this
easier to understand patch?

-- 
Thanks,

Steve

  reply	other threads:[~2026-04-22 15:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-09  9:59 [PATCH 1/9] smb: client: block non-reconfigurable option changes on remount rajasimandalos
2026-04-09  9:59 ` [PATCH 2/9] smb: client: allow both 'lease' and 'nolease' mount options rajasimandalos
2026-04-13 13:30   ` Meetakshi Setiya
2026-04-09  9:59 ` [PATCH 3/9] smb: client: sync tcon-level options on remount rajasimandalos
2026-04-17 14:29   ` Meetakshi Setiya
2026-04-09  9:59 ` [PATCH 4/9] smb: client: sync retrans " rajasimandalos
2026-04-09  9:59 ` [PATCH 5/9] smb: client: sync echo_interval " rajasimandalos
2026-04-22  4:42   ` [PATCH v2] " rajasimandalos
2026-04-09  9:59 ` [PATCH 6/9] smb: client: allow nolease option to be reconfigured " rajasimandalos
2026-04-22  5:06   ` [PATCH v2] " rajasimandalos
2026-04-22  8:36     ` Bharath SM
2026-04-22 15:29       ` Steve French [this message]
2026-04-09  9:59 ` [PATCH 7/9] smb: client: block cache=ro and cache=singleclient " rajasimandalos
2026-04-13 13:40   ` Meetakshi Setiya
2026-04-22  4:34     ` RAJASI MANDAL
2026-04-09  9:59 ` [PATCH 8/9] smb: client: fix domainauto remount by syncing domainname from session rajasimandalos
2026-04-09  9:59 ` [PATCH 9/9] smb: client: apply rasize on remount rajasimandalos
2026-04-13 13:29   ` Meetakshi Setiya
2026-04-13  7:32 ` [PATCH v2 1/9] smb: client: block non-reconfigurable option changes " Rajasi Mandal
2026-04-17 14:05   ` Meetakshi Setiya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH2r5msBOKixrOyyeEt4Es6W3eABVFMx2iwMcRakiRvD6fYatA@mail.gmail.com \
    --to=smfrench@gmail.com \
    --cc=bharathsm.hsk@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=rajasimandal@microsoft.com \
    --cc=rajasimandalos@gmail.com \
    --cc=sfrench@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).