Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Chuck Lever III <chuck.lever@oracle.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH RFC] NFSD: Fix possible sleep during nfsd4_release_lockowner()
Date: Mon, 23 May 2022 16:32:26 -0400	[thread overview]
Message-ID: <b0ffb06ca7c270e2e3c3ae1b25596c32b6c5b54a.camel@kernel.org> (raw)
In-Reply-To: <20220523201752.GI24163@fieldses.org>

On Mon, 2022-05-23 at 16:17 -0400, J. Bruce Fields wrote:
> On Mon, May 23, 2022 at 03:43:28PM -0400, Jeff Layton wrote:
> > On Mon, 2022-05-23 at 19:35 +0000, Chuck Lever III wrote:
> > > 
> > > > On May 23, 2022, at 1:38 PM, Jeff Layton <jlayton@kernel.org> wrote:
> > > > 
> > > > On Mon, 2022-05-23 at 17:25 +0000, Chuck Lever III wrote:
> > > > > 
> > > > > > On May 23, 2022, at 12:37 PM, Jeff Layton <jlayton@kernel.org> wrote:
> > > > > > 
> > > > > > His suggestion was just to keep a counter in the lockowner of how many
> > > > > > locks are associated with it. That seems like a good suggestion, though
> > > > > > you'd probably need to add a parameter to lm_get_owner to indicate
> > > > > > whether you were adding a new lock or just doing a conflock copy.
> > > > > 
> > > > > locks_copy_conflock() would need to take a boolean parameter
> > > > > that callers would set when they actually manipulate a lock.
> > > > > 
> > > > 
> > > > Yep. You'd also have to add a bool arg to lm_put_owner so that you know
> > > > whether you need to decrement the counter.
> > > 
> > > It's the lm_put_owner() side that looks less than straightforward.
> > > Suggestions and advice welcome there.
> > > 
> > 
> > Maybe add a new fl_flags value that indicates that a particular lock is
> > a conflock and not a lock record? Then locks_release_private could use
> > that to pass the appropriate argument to lm_put_owner.
> > 
> > That's probably simpler overall than trying to audit all of the
> > locks_free_lock callers.
> 
> Should conflock parameters really be represented by file_lock structures
> at all?  It always seemed a little wrong to me.  But, that's a bit of
> derail, apologies.
> 

Probably not.

Lock requests should also not be represented by struct file_lock, but
that decision was made quite some time ago. We could change these things
these days, but it'd be a lot of churn.

Even if we did use a different struct for conflocks though, it would
still need a way to point at the lockowner (or clone/free its info
somehow). It wouldn't materially change what we need to do here.
-- 
Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2022-05-23 20:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-22 15:38 [PATCH RFC] NFSD: Fix possible sleep during nfsd4_release_lockowner() Chuck Lever
2022-05-23 13:40 ` Jeff Layton
2022-05-23 15:00   ` Chuck Lever III
2022-05-23 15:26     ` Jeff Layton
2022-05-23 15:41       ` Chuck Lever III
2022-05-23 16:37         ` Jeff Layton
2022-05-23 17:25           ` Chuck Lever III
2022-05-23 17:38             ` Jeff Layton
2022-05-23 19:35               ` Chuck Lever III
2022-05-23 19:43                 ` Jeff Layton
2022-05-23 20:17                   ` J. Bruce Fields
2022-05-23 20:32                     ` Jeff Layton [this message]
2022-05-23 17:43           ` Trond Myklebust
2022-05-23 18:04             ` Jeff Layton
2022-05-23 18:21               ` Trond Myklebust
2022-05-23 18:30                 ` Jeff Layton
2022-05-23 19:13                   ` Chuck Lever III
2022-05-23 19:36                     ` Jeff Layton
2022-05-23 20:29                       ` J. Bruce Fields
2022-05-23 21:15                         ` Jeff Layton
2022-05-23 21:28                           ` J. Bruce Fields
2022-05-24  0:07                             ` J. Bruce Fields
2022-05-23 22:18             ` Chuck Lever III

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=b0ffb06ca7c270e2e3c3ae1b25596c32b6c5b54a.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.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