Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Steve Dickson <SteveD@redhat.com>
Cc: Chuck Lever <chuck.lever@oracle.com>,
	Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 1/1] exportfs: Stop racing exportfs on clusters
Date: Thu, 8 Mar 2012 13:53:50 -0500	[thread overview]
Message-ID: <20120308185350.GA9273@fieldses.org> (raw)
In-Reply-To: <4F58CC1E.4030805@RedHat.com>

On Thu, Mar 08, 2012 at 10:11:26AM -0500, Steve Dickson wrote:
> 
> 
> On 03/07/2012 03:52 PM, Chuck Lever wrote:
> > 
> > On Mar 7, 2012, at 3:50 PM, J. Bruce Fields wrote:
> > 
> >> On Wed, Mar 07, 2012 at 03:36:49PM -0500, bfields wrote:
> >>> On Wed, Mar 07, 2012 at 02:56:30PM -0500, Steve Dickson wrote:
> >>>> This problem can occur when multiple cluster services fail over
> >>>> at the same time, causing missing high-available exports.
> >>>> Having a lot of nfs-exports will trigger this issue easier.
> >>>
> >>> Isn't the locking in support/export/xtab.c supposed to take care of
> >>> this?
> >>
> >> Huh, maybe that's just meant to prevent etab from getting corrupted, or
> >> mountd from seeing a partially-written file.
> >>
> >> But it probably doesn't prevent two exportfs processes from both reading
> >> etab, adding an export, and each writing out an etab with its one export
> >> added, with the last writer winning.
> >>
> >> Was that the problem?
> > 
> > For bug 224, yes.  After disparate concurrent exportfs commands race, the etab file ends up missing some exports.
> This morning I took another look at this and there does indeed need to
> be some global lock to stop to serialize dueling exportfs commands. The
> locks in xtab.c are just to granular....

Right, makes sense.  So just in hopes that I don't ask the same question
next time this comes up, could we find a good spot for a comment, maybe
something like this?:

	/*
	 * If we aren't careful, changes made by exportfs can be lost
	 * when multiple exports process run at once:
	 *
	 *	exportfs process 1	exportfs process 2
	 *	------------------------------------------
	 *	reads etab version A	reads etab version A
	 *	adds new export B	adds new export C
	 *	writes A+B		writes A+C
	 
	 * The locking in support/export/xtab.c will prevent mountd from
	 * seeing a partially written version of etab, and will prevent 
	 * the two writers above from writing simultaneously and
	 * corrupting etab, but to prevent problems like the above we
	 * need this additional lock:
	 */

Uh, or maybe you can come up with something shorter.

--b.

  reply	other threads:[~2012-03-08 18:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 19:56 [PATCH 1/1] exportfs: Stop racing exportfs on clusters Steve Dickson
2012-03-07 20:07 ` Chuck Lever
2012-03-07 20:19   ` Steve Dickson
2012-03-07 20:36 ` J. Bruce Fields
2012-03-07 20:50   ` J. Bruce Fields
2012-03-07 20:52     ` Chuck Lever
2012-03-08 15:11       ` Steve Dickson
2012-03-08 18:53         ` J. Bruce Fields [this message]
2012-03-07 20:53   ` Steve Dickson

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=20120308185350.GA9273@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=SteveD@redhat.com \
    --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