From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jeff Layton <jlayton@poochiereds.net>
Cc: Christoph Hellwig <hch@lst.de>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH RFC] nfsd: serialize layout stateid morphing operations
Date: Fri, 23 Oct 2015 15:35:59 -0400 [thread overview]
Message-ID: <20151023193559.GB16137@fieldses.org> (raw)
In-Reply-To: <20151011165121.5f5d81c1@tlielax.poochiereds.net>
On Sun, Oct 11, 2015 at 04:51:21PM -0400, Jeff Layton wrote:
> On Sun, 11 Oct 2015 15:15:27 +0200
> Christoph Hellwig <hch@lst.de> wrote:
>
> > On Thu, Sep 17, 2015 at 07:58:24AM -0400, Jeff Layton wrote:
> > > In order to allow the client to make a sane determination of what
> > > happened with racing LAYOUTGET/LAYOUTRETURN/CB_LAYOUTRECALL calls, we
> > > must ensure that the seqids return accurately represent the order of
> > > operations. The simplest way to do that is to ensure that operations on
> > > a single stateid are serialized.
> > >
> > > This patch adds a mutex to the layout stateid, and locks it when
> > > checking the layout stateid's seqid. The mutex is held over the entire
> > > operation and released after the seqid is bumped.
> > >
> > > Note that in the case of CB_LAYOUTRECALL we must move the increment of
> > > the seqid and setting into a new cb "prepare" operation. The lease
> > > infrastructure will call the lm_break callback with a spinlock held, so
> > > and we can't take the mutex in that codepath.
> >
> > I can't say I like the long running mutex all that much. What kinds
> > of reproducers do you have where the current behavior causes problems?
>
> I'm not thrilled with it either, though it is per-stateid. It should
> only ever be contended when there are concurrent operations that specify
> the same stateid.
>
> We did have a report of this problem with open stateids that came about
> after the client started parallelizing opens more aggressively. It was
> pretty clear that you could hit similar races with lock stateids as
> well, given a client that didn't serialize things properly.
>
> I don't have any reports of this problem with layout stateids though.
> It may be that the client is good enough at serializing these
> operations (or slow enough) that it's never an issue. But, if that's
> the case then the mutex is harmless anyway since it'd never be
> contended.
>
> In hindsight I probably should have sent this as a RFC patch, I'm fine
> with dropping this for now if you think it's potentially harmful.
Still looks to me like the code's incorrect without your patch, so I
intend to apply it.
I'll fully admit that I haven't looked at how layout stateid's are
supposed to work closely enough so it's possible Christoph can persaude
me otherwise.
--b.
next prev parent reply other threads:[~2015-10-23 19:36 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 11:58 [PATCH RFC] nfsd: serialize layout stateid morphing operations Jeff Layton
2015-10-11 13:15 ` Christoph Hellwig
2015-10-11 20:51 ` Jeff Layton
2015-10-23 19:35 ` J. Bruce Fields [this message]
2015-11-29 4:07 ` Kinglong Mee
2015-11-29 13:46 ` Jeff Layton
2015-11-30 2:57 ` Kinglong Mee
2015-11-30 21:34 ` J. Bruce Fields
2015-12-01 0:33 ` Jeff Layton
2015-12-01 0:55 ` Trond Myklebust
2015-12-01 11:56 ` Christoph Hellwig
2015-12-01 22:48 ` Jeff Layton
2015-12-02 7:25 ` Christoph Hellwig
2015-12-03 22:08 ` J. Bruce Fields
2015-12-04 8:38 ` Christoph Hellwig
2015-12-04 20:51 ` Jeff Layton
2015-12-05 12:02 ` Christoph Hellwig
2015-12-05 12:24 ` Jeff Layton
2015-12-06 13:09 ` Jeff Layton
2015-12-07 13:09 ` Christoph Hellwig
2015-12-07 13:28 ` Jeff Layton
2015-12-07 14:17 ` Christoph Hellwig
2015-12-07 16:12 ` Jeff Layton
2015-12-07 16:43 ` J. Bruce Fields
2015-12-16 16:55 ` J. Bruce Fields
2015-12-07 13:07 ` Christoph Hellwig
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=20151023193559.GB16137@fieldses.org \
--to=bfields@fieldses.org \
--cc=hch@lst.de \
--cc=jlayton@poochiereds.net \
--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