From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <cel@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Chuck Lever <chuck.lever@oracle.com>,
Alexander Aring <alex.aring@gmail.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Jonathan Corbet <corbet@lwn.net>, NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/2] filelock: add lease_dispose_list() helper
Date: Wed, 03 Dec 2025 14:33:39 -0500 [thread overview]
Message-ID: <697eb0d57f34882317e1f5cd73951f1e3b1e3175.camel@kernel.org> (raw)
In-Reply-To: <9a6f7f4b-dc45-4288-a8ee-6dcaabd19eb9@app.fastmail.com>
On Wed, 2025-12-03 at 13:55 -0500, Chuck Lever wrote:
>
> On Mon, Dec 1, 2025, at 10:08 AM, Jeff Layton wrote:
> > ...and call that from the lease handling code instead of
> > locks_dispose_list(). Remove the lease handling parts from
> > locks_dispose_list().
>
> The actual change here isn't bothering me, but I'm having trouble
> understanding why it's needed. It doesn't appear to be a strict
> functional prerequisite for 2/2.
>
It's not. We can table this patch for now if that's preferable, but I
do think it's a worthwhile cleanup.
> A little more context in the commit message would be helpful.
> Sample commit description:
>
> The lease-handling code paths always know they're disposing of leases,
> yet locks_dispose_list() checks flags at runtime to determine whether
> to call locks_free_lease() or locks_free_lock().
>
> Split out a dedicated lease_dispose_list() helper for lease code paths.
> This makes the type handling explicit and prepares for the upcoming
> lease_manager enhancements where lease-specific operations are being
> consolidated.
>
I may crib this if I end up resending it.
> But that reflects only my naive understanding of the patch. You
> might have something else in mind.
>
>
Nope, no ulterior motive here. It's just a nice to have cleanup that
helps to further separate the lock and lease handling code.
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/locks.c | 29 +++++++++++++++++++----------
> > 1 file changed, 19 insertions(+), 10 deletions(-)
> >
> > diff --git a/fs/locks.c b/fs/locks.c
> > index
> > 7f4ccc7974bc8d3e82500ee692c6520b53f2280f..e974f8e180fe48682a271af4f143e6bc8e9c4d3b
> > 100644
> > --- a/fs/locks.c
> > +++ b/fs/locks.c
> > @@ -369,10 +369,19 @@ locks_dispose_list(struct list_head *dispose)
> > while (!list_empty(dispose)) {
> > flc = list_first_entry(dispose, struct file_lock_core, flc_list);
> > list_del_init(&flc->flc_list);
> > - if (flc->flc_flags & (FL_LEASE|FL_DELEG|FL_LAYOUT))
> > - locks_free_lease(file_lease(flc));
> > - else
> > - locks_free_lock(file_lock(flc));
> > + locks_free_lock(file_lock(flc));
> > + }
> > +}
> > +
> > +static void
> > +lease_dispose_list(struct list_head *dispose)
> > +{
> > + struct file_lock_core *flc;
> > +
> > + while (!list_empty(dispose)) {
> > + flc = list_first_entry(dispose, struct file_lock_core, flc_list);
> > + list_del_init(&flc->flc_list);
> > + locks_free_lease(file_lease(flc));
> > }
> > }
> >
> > @@ -1620,7 +1629,7 @@ int __break_lease(struct inode *inode, unsigned int flags)
> > spin_unlock(&ctx->flc_lock);
> > percpu_up_read(&file_rwsem);
> >
> > - locks_dispose_list(&dispose);
> > + lease_dispose_list(&dispose);
> > error = wait_event_interruptible_timeout(new_fl->c.flc_wait,
> > list_empty(&new_fl->c.flc_blocked_member),
> > break_time);
> > @@ -1643,7 +1652,7 @@ int __break_lease(struct inode *inode, unsigned
> > int flags)
> > out:
> > spin_unlock(&ctx->flc_lock);
> > percpu_up_read(&file_rwsem);
> > - locks_dispose_list(&dispose);
> > + lease_dispose_list(&dispose);
> > free_lock:
> > locks_free_lease(new_fl);
> > return error;
> > @@ -1726,7 +1735,7 @@ static int __fcntl_getlease(struct file *filp,
> > unsigned int flavor)
> > spin_unlock(&ctx->flc_lock);
> > percpu_up_read(&file_rwsem);
> >
> > - locks_dispose_list(&dispose);
> > + lease_dispose_list(&dispose);
> > }
> > return type;
> > }
> > @@ -1895,7 +1904,7 @@ generic_add_lease(struct file *filp, int arg,
> > struct file_lease **flp, void **pr
> > out:
> > spin_unlock(&ctx->flc_lock);
> > percpu_up_read(&file_rwsem);
> > - locks_dispose_list(&dispose);
> > + lease_dispose_list(&dispose);
> > if (is_deleg)
> > inode_unlock(inode);
> > if (!error && !my_fl)
> > @@ -1931,7 +1940,7 @@ static int generic_delete_lease(struct file
> > *filp, void *owner)
> > error = fl->fl_lmops->lm_change(victim, F_UNLCK, &dispose);
> > spin_unlock(&ctx->flc_lock);
> > percpu_up_read(&file_rwsem);
> > - locks_dispose_list(&dispose);
> > + lease_dispose_list(&dispose);
> > return error;
> > }
> >
> > @@ -2726,7 +2735,7 @@ locks_remove_lease(struct file *filp, struct
> > file_lock_context *ctx)
> > spin_unlock(&ctx->flc_lock);
> > percpu_up_read(&file_rwsem);
> >
> > - locks_dispose_list(&dispose);
> > + lease_dispose_list(&dispose);
> > }
> >
> > /*
> >
> > --
> > 2.52.0
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2025-12-03 19:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 15:08 [PATCH 0/2] filelock: fix conflict detection with userland file delegations Jeff Layton
2025-12-01 15:08 ` [PATCH 1/2] filelock: add lease_dispose_list() helper Jeff Layton
2025-12-03 18:55 ` Chuck Lever
2025-12-03 19:33 ` Jeff Layton [this message]
2025-12-03 19:35 ` Chuck Lever
2025-12-03 22:41 ` NeilBrown
2025-12-01 15:08 ` [PATCH 2/2] filelock: allow lease_managers to dictate what qualifies as a conflict Jeff Layton
2025-12-03 19:00 ` Chuck Lever
2025-12-03 19:44 ` Jeff Layton
2025-12-01 15:19 ` [PATCH 0/2] filelock: fix conflict detection with userland file delegations Chuck Lever
2025-12-01 15:52 ` Jeff Layton
2025-12-01 16:01 ` Chuck Lever
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=697eb0d57f34882317e1f5cd73951f1e3b1e3175.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=alex.aring@gmail.com \
--cc=brauner@kernel.org \
--cc=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=corbet@lwn.net \
--cc=jack@suse.cz \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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 NNTP newsgroup(s).