linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Junxiao Bi <junxiao.bi@oracle.com>
Cc: linux-nfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: rpciod deadlock issue
Date: Mon, 25 Aug 2014 16:15:22 +1000	[thread overview]
Message-ID: <20140825161522.3cb91100@notabene.brown> (raw)
In-Reply-To: <20140825160501.433b3e9e@notabene.brown>

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

On Mon, 25 Aug 2014 16:05:01 +1000 NeilBrown <neilb@suse.de> wrote:

> On Fri, 22 Aug 2014 15:55:30 +0800 Junxiao Bi <junxiao.bi@oracle.com> wrote:
> 
> > Hi All,
> > 
> > I got an nfs hung issue, looks like "rpciod" run into deadlock. Bug is
> > reported on 2.6.32, but seems mainline also suffers this bug from the
> > source code.
> > 
> > See the following rpciod trace. rpciod allocated memory using GFP_KERNEL
> > in xs_setup_xprt(). That triggered direct reclaim when available memory
> > was not enough, where it waited an write-back page done, but that page
> > was a nfs page, and it depended on rpciod to write back. So this caused
> > a deadlock.
> > 
> > I am not sure how to fix this issue. Replace GFP_KERNEL with GFP_NOFS in
> > xs_setup_xprt() can fix this trace, but there are other place allocating
> > memory with GFP_KERNEL in rpciod, like
> > xs_tcp_setup_socket()->xs_create_sock()->__sock_create()->sock_alloc(),
> > there is no way to pass GFP_NOFS to network command code. Also mainline
> > has changed to not care ___GFP_FS before waiting page write back done.
> > Upstream commit 5cf02d0 (nfs: skip commit in releasepage if we're
> > freeing memory for fs-related reasons) uses PF_FSTRANS to avoid another
> > deadlock when direct reclaim, i am thinking whether we can check
> > PF_FSTRANS flag in shrink_page_list(), if this flag is set, it will not
> > wait any page write back done? I saw this flag is also used by xfs, not
> > sure whether this will affect xfs.
> > 
> > Any advices is appreciated.
> 
> This problem shouldn't affect mainline.
> 
> Since Linux 3.2, "direct reclaim" never wait for writeback - that is left for
> kswapd to do. (See "A pivotal patch" in https://lwn.net/Articles/595652/)
> So this deadlock cannot happen.

Sorry, that might not quite be right.  That change meant that direct reclaim
would never *initiate* writeout.  It can sometimes wait for it.
Sorry.

NeilBrown

> 
> Probably the simplest fix for your deadlock would be:
> - in shrink_page_list, clear may_enter_fs if PF_FSTRANS is set.
> - in rpc_async_schedule, set PF_FSTRANS before calling __rpc_execute, and
>   clear it again afterwards.
> 
> NeilBrown
> 

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

      reply	other threads:[~2014-08-25  6:15 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22  7:55 rpciod deadlock issue Junxiao Bi
2014-08-22 22:49 ` [PATCH v2 1/2] SUNRPC: Fix memory reclaim deadlocks in rpciod Trond Myklebust
2014-08-22 22:49   ` [PATCH v2 2/2] NFS: Ensure that rpciod does not trigger reclaim writebacks Trond Myklebust
2014-08-25  5:34   ` [PATCH v2 1/2] SUNRPC: Fix memory reclaim deadlocks in rpciod Junxiao Bi
2014-08-25  6:48   ` NeilBrown
2014-08-26  5:43     ` Junxiao Bi
2014-08-26  6:21       ` NeilBrown
2014-08-26  6:49         ` Junxiao Bi
2014-08-26  7:04           ` NeilBrown
2014-08-26  7:23             ` Junxiao Bi
2014-08-26 10:53     ` Mel Gorman
2014-08-26 12:58       ` Trond Myklebust
2014-08-26 13:26         ` Mel Gorman
2014-08-26 23:19           ` Johannes Weiner
2014-08-26 23:51             ` Trond Myklebust
2014-08-27  0:00               ` Trond Myklebust
2014-08-27 15:36                 ` Mel Gorman
2014-08-27 16:15                   ` Trond Myklebust
2014-08-28  8:30                     ` Mel Gorman
2014-08-28  8:49                       ` Junxiao Bi
2014-08-28  9:25                         ` Mel Gorman
2014-09-04 13:54                   ` Michal Hocko
2014-09-09  2:33                     ` NeilBrown
2014-09-10 13:48                       ` Michal Hocko
2014-09-10 23:57                         ` NeilBrown
2014-09-11  8:50                           ` Michal Hocko
2014-09-11 10:53                             ` NeilBrown
2014-08-27  1:43             ` NeilBrown
2014-08-25  6:05 ` rpciod deadlock issue NeilBrown
2014-08-25  6:15   ` 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=20140825161522.3cb91100@notabene.brown \
    --to=neilb@suse.de \
    --cc=junxiao.bi@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).