linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>,
	NFS <linux-nfs@vger.kernel.org>
Subject: Re: Live lock in silly-rename.
Date: Fri, 30 May 2014 13:44:42 +1000	[thread overview]
Message-ID: <20140530134442.5a8e5983@notabene.brown> (raw)
In-Reply-To: <20140530004423.GA13746@fieldses.org>

[-- Attachment #1: Type: text/plain, Size: 2785 bytes --]

On Thu, 29 May 2014 20:44:23 -0400 "J. Bruce Fields" <bfields@fieldses.org>
wrote:

> On Fri, May 30, 2014 at 07:51:35AM +1000, NeilBrown wrote:
> > On Thu, 29 May 2014 12:38:19 -0400 Trond Myklebust
> > <trond.myklebust@primarydata.com> wrote:
> > 
> > > Apologies Neil. Resending due to gmail defaulting to html formatting
> > > which gets rejected by vger.kernel.org...
> > > 
> > > On Thu, May 29, 2014 at 2:45 AM, NeilBrown <neilb@suse.de> wrote:
> > > >
> > > > The program below (provided by a customer) demonstrates a livelock that can
> > > > trigger in NFS.
> > > >
> > > > "/mnt" should be an NFSv4 mount from a server which will hand out READ
> > > > delegations (e.g. the Linux NFS server) and should contain a subdirectory
> > > > "/mnt/data".
> > > >
> > > > The program forks off some worker threads which poll a particular file in
> > > > that directory until it disappears.  Then each worker will exit.
> > > > The main program waits a few seconds and then unlinks the file.
> > > >
> > > > The number of threads can be set with the first arg (4 is good). The number of
> > > > seconds with the second.  Both have useful defaults.
> > > >
> > > > The unlink should happen promptly and then all the workers should  exit.  But
> > > > they don't.
> > > >
> > > > What happens is that between when the "unlink" returns the delegation that it
> > > > will inevitably have due to all those "open"s, and when it performs the
> > > > required silly-rename (because some thread will have the file open), some
> > > > other thread opens the file and gets a delegation.
> > > > So the NFSv4 RENAME returns NFS4ERR_DELAY while it tries to reclaim the
> > > > delegation.  15 seconds later the rename will be retried, but there will still
> > > > (or again) be an active delegation.  So the pattern repeats indefinitely.
> > > > All this time the i_mutex on the directory and file are held so "ls" on the
> > > > directory will also hang.
> > > 
> > > Why would the server hand out another delegation just moments after it
> > > recalled the last one? That sounds like a nasty server bug.
> > 
> > Exactly how long should it wait?
> > Bruce: do you have any thoughts on whether the server should hold off giving
> > out new delegations after trying to recall one (e.g. due to a lease-break
> > caused by rename)??
> > I don't suppose the RFC addresses this?
> 
> Yes, it's a known server bug.
> 
> As a first attempt I was thinking of just sticking a timestamp in struct
> inode to record the time of the most recent conflicting access and deny
> delegations if the timestamp is too recent, for some definition of too
> recent.
> 

Hmmm... I'll have a look next week and see what I can come up with.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2014-05-30  3:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29  6:45 Live lock in silly-rename NeilBrown
2014-05-29 16:38 ` Trond Myklebust
     [not found]   ` <20140530075135.753fb7ed@notabene.brown>
2014-05-30  0:44     ` J. Bruce Fields
2014-05-30  3:44       ` NeilBrown [this message]
2014-05-30 21:55         ` J. Bruce Fields
2014-05-30 22:13           ` NeilBrown
2014-06-04  7:39             ` NeilBrown
2014-06-04 12:48               ` Trond Myklebust
2014-06-04 13:27                 ` J. Bruce Fields
2014-06-05  0:26                   ` NeilBrown
2014-06-05  0:40                 ` NeilBrown
2014-06-04 22:05               ` J. Bruce Fields
2014-06-05  0:34                 ` NeilBrown
2014-06-11 14:21                   ` J. Bruce Fields
2014-06-12  1:43                     ` NeilBrown

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=20140530134442.5a8e5983@notabene.brown \
    --to=neilb@suse.de \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.com \
    /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).