mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	"Myklebust, Trond" <Trond.Myklebust@netapp.com>,
	Mandeep Singh Baines <msb@chromium.org>,
	Ming Lei <ming.lei@canonical.com>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: LOCKDEP: 3.9-rc1: mount.nfs/4272 still has locks held!
Date: Thu, 7 Mar 2013 06:41:40 -0500	[thread overview]
Message-ID: <20130307064140.71c0936b@tlielax.poochiereds.net> (raw)
In-Reply-To: <20130306213636.GP1227@htj.dyndns.org>

On Wed, 6 Mar 2013 13:36:36 -0800
Tejun Heo <tj@kernel.org> wrote:

> On Wed, Mar 06, 2013 at 01:31:10PM -0800, Linus Torvalds wrote:
> > So I do agree that we probably have *too* many of the stupid "let's
> > check if we can freeze", and I suspect that the NFS code should get
> > rid of the "freezable_schedule()" that is causing this warning
> > (because I also agree that you should *not* freeze while holding
> > locks, because it really can cause deadlocks), but I do suspect that
> > network filesystems do need to have a few places where they check for
> > freezing on their own... Exactly because freezing isn't *quite* like a
> > signal.
> 
> Well, I don't really know much about nfs so I can't really tell, but
> for most other cases, dealing with freezing like a signal should work
> fine from what I've seen although I can't be sure before actually
> trying.  Trond, Bruce, can you guys please chime in?
> 
> Thanks.
> 

(hopefully this isn't tl;dr)

It's not quite that simple...

The problem (as Trond already mentioned) is non-idempotent operations.
You can't just restart certain operations from scratch once you reach a
certain point. Here's an example:

Suppose I call unlink("somefile"); on an NFS mount. We take all of the
VFS locks, go down into the NFS layer. That marshals up the UNLINK
call, sends it off to the server, and waits for the reply. While we're
waiting, a freeze event comes in and we start returning from the
kernel with our new -EFREEZE return code that works sort of like
-ERESTARTSYS. Meanwhile, the server is processing the UNLINK call and
removes the file. A little while later we wake up the machine and it
goes to try and pick up where it left off.

What do we do now?

Suppose we pretend we never sent the call in the first place, marshal
up a new RPC and send it again. This is problematic -- the server will
probably send back the equivalent of ENOENT. How do we know whether the
file never existed in the first place, or whether the server processed
the original call and removed the file then?

Do we instead try and keep track of whether the RPC has been sent and
just wait for the reply on the original call? That's tricky too -- it
means adding an extra codepath to check for these sorts of restarts in
a bunch of different ops vectors into the filesystem. We also have to
somehow keep track of this state too (I guess by hanging something off
the task_struct).

Note too that the above is the simple case. We're dropping the parent's
i_mutex during the freeze. Suppose when we restart the call that the
parent directory has changed in such a way that the original lookup we
did to do the original RPC is no longer valid?

I think Trond may be on the right track. We probably need some
mechanism to quiesce the filesystem ahead of any sort of freezer
event. That quiesce could simply wait on any in flight RPCs to come
back, and not allow any new ones to go out. On syscalls where the RPC
didn't go out, we'd just return -EFREEZE or whatever and let the upper
layers restart the call after waking back up. Writeback would be
tricky, but that can be handled too.

The catch here is that it's quite possible that when we need to quiesce
that we've lost communications with the server. We don't want to hold
up the freezer at that point so the wait for replies has to be bounded
in time somehow. If that times out, we probably just have to return all
calls with our new -EFREEZE return and hope for the best when the
machine wakes back up.

-- 
Jeff Layton <jlayton@redhat.com>

  parent reply	other threads:[~2013-03-07 11:42 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04 13:57 Ming Lei
2013-03-04 14:14 ` Myklebust, Trond
2013-03-04 14:23   ` Jeff Layton
2013-03-04 19:55     ` Mandeep Singh Baines
2013-03-04 20:53       ` Oleg Nesterov
2013-03-04 22:08         ` Myklebust, Trond
2013-03-05 13:23           ` Jeff Layton
2013-03-05 17:46             ` Tejun Heo
2013-03-05 17:49               ` Tejun Heo
2013-03-05 19:03                 ` Jeff Layton
2013-03-05 19:09                   ` Tejun Heo
2013-03-05 23:39                     ` Jeff Layton
2013-03-05 23:47                       ` Tejun Heo
2013-03-06 18:16                         ` Oleg Nesterov
2013-03-06 18:53                           ` Tejun Heo
2013-03-06 21:00                             ` Linus Torvalds
2013-03-06 21:24                               ` Tejun Heo
2013-03-06 21:31                                 ` Linus Torvalds
2013-03-06 21:36                                   ` Tejun Heo
2013-03-06 21:40                                     ` Tejun Heo
2013-03-13 15:17                                       ` Jeff Layton
2013-03-31  0:07                                         ` Paul Walmsley
2013-03-07 11:41                                     ` Jeff Layton [this message]
2013-03-07 15:25                                       ` Tejun Heo
2013-03-07 15:55                                       ` Linus Torvalds
2013-03-07 15:59                                         ` Myklebust, Trond
2013-03-07 16:25                                           ` Linus Torvalds
2013-03-07 16:45                                             ` Myklebust, Trond
2013-03-07 17:03                                               ` Linus Torvalds
2013-03-07 17:16                                                 ` Myklebust, Trond
2013-03-07 21:43                                                   ` Jeff Layton
2013-03-08 14:01                                                 ` Ingo Molnar
2013-03-07 20:55                                             ` Rafael J. Wysocki
2013-03-07 16:00                                         ` Tejun Heo
2013-03-06 18:17                       ` Oleg Nesterov
2013-03-06 18:40                         ` Jeff Layton
2013-03-06 18:45                           ` Tejun Heo
2013-03-06  1:10                   ` Myklebust, Trond
2013-03-06  1:14                     ` Tejun Heo
2013-03-06  1:28                       ` Tejun Heo
2013-03-06 12:00                     ` Jeff Layton
2013-03-05 23:11                 ` J. Bruce Fields
2013-03-06  0:02                   ` Rafael J. Wysocki
2013-03-06  0:30                   ` [PATCH] lockdep: make lock held while freezing check optional Mandeep Singh Baines
2013-03-07 12:03                     ` Maarten Lankhorst
2013-03-06  0:59                   ` LOCKDEP: 3.9-rc1: mount.nfs/4272 still has locks held! Mandeep Singh Baines
2013-03-06  1:05                     ` J. Bruce Fields
2013-03-06  1:16                       ` Tejun Heo
2013-03-06  3:11                         ` Mandeep Singh Baines
2013-03-06  9:09                           ` Ingo Molnar
2013-03-06 12:06                             ` Jeff Layton
2013-03-06 15:59                               ` Mandeep Singh Baines
2013-03-06 18:23                                 ` Jeff Layton
2013-03-06 18:37                                   ` Myklebust, Trond
2013-03-06 20:15                                     ` Mandeep Singh Baines
2013-03-04 14:40   ` Ming Lei
2013-03-04 15:04     ` Jeff Layton
2013-03-04 15:33       ` Ming Lei
2013-03-04 15:53         ` Myklebust, Trond
2013-03-04 20:09           ` Mandeep Singh Baines
2013-03-04 20:10             ` Mandeep Singh Baines

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=20130307064140.71c0936b@tlielax.poochiereds.net \
    --to=jlayton@redhat.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=akpm@linux-foundation.org \
    --cc=bfields@fieldses.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=mingo@redhat.com \
    --cc=msb@chromium.org \
    --cc=oleg@redhat.com \
    --cc=rjw@sisk.pl \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®