From: NeilBrown <neilb@suse.de>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: NFS <linux-nfs@vger.kernel.org>, Tejun Heo <tj@kernel.org>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] NFS: state manager thread must stay running.
Date: Wed, 17 Sep 2014 13:05:12 +1000 [thread overview]
Message-ID: <20140917130512.744593fd@notabene.brown> (raw)
In-Reply-To: <CAHQdGtTrWhX=iE9y1nWH13M=kt1dbu=_dwdNVSQGBh1BeZ9aTA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2313 bytes --]
On Tue, 16 Sep 2014 21:43:07 -0400 Trond Myklebust
<trond.myklebust@primarydata.com> wrote:
> On Wed, Aug 13, 2014 at 12:08 AM, NeilBrown <neilb@suse.de> wrote:
> >
> >
> > If the server restarts at an awkward time it is possible for write
> > requests to block waiting for the state manager to run.
> > If the state manager isn't already running a new thread will
> > need to be started which requires a GFP_KERNEL allocation
> > (for do_fork).
> >
> > If memory is short, that GFP_KERNEL allocation could block on the
> > writes going out via NFS, resulting in a deadlock.
> >
> > The easiest solution is to keep the manager thread running
> > always.
>
> I'm still trying to figure out what to do about this patch. There are
> 2 concerns:
>
> 1) If we're so low on memory that we can't even start a state manager
> thread, then how do we guarantee that the recovery can be completed?
> We rely on that state manager thread being able to allocate memory to
> perform the lease, session, open and lock recoveries.
All the allocations performed by the state manager are (I assume) GFP_NOFS.
Creating a new thread requires GFP_KERNEL allocations, particularly in
dup_task_struct, which is called by kthreadd, which is well out of reach for
NFS to try to change the GFP flags.
Having said that, it occurs to me that my other dead-lock avoidance patch
might fix this problem as well.
The one case where I have seen a problem with starting the state manager, the
machine in question had several memory-shortage issues. I think we finally
decided that a problem with too_many_isolated handling was the main cause.
So I cannot get very much reliable information from the stack trace there. I
presume that in the current kernel, thread creation could deadlock against
nfs_release_page() (it was actually stuck in a congestion_wait()).
So I can't be certain, but I think this proactive thread creation won't be
needed once nfs_release_page() doesn't block indefinitely.
So you can drop this patch.
Thanks.
Though on the topic of patches that you don't know what to do with ....
Could you have a look at
http://permalink.gmane.org/gmane.linux.nfs/56154
it appears that it slipped under your radar, and it fell of mine until just
recently.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
prev parent reply other threads:[~2014-09-17 3:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-13 4:08 [PATCH] NFS: state manager thread must stay running NeilBrown
2014-08-17 13:11 ` Tejun Heo
2014-08-17 21:14 ` NeilBrown
2014-08-18 14:29 ` Tejun Heo
2014-09-17 1:43 ` Trond Myklebust
2014-09-17 3:05 ` NeilBrown [this message]
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=20140917130512.744593fd@notabene.brown \
--to=neilb@suse.de \
--cc=hch@infradead.org \
--cc=linux-nfs@vger.kernel.org \
--cc=tj@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).