public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Peter Watkins <treestem@gmail.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: fix memory reclaim deadlock on agi buffer
Date: Tue, 8 May 2012 09:18:38 +1000	[thread overview]
Message-ID: <20120507231838.GB5091@dastard> (raw)
In-Reply-To: <1336421497-1554-1-git-send-email-treestem@gmail.com>

On Mon, May 07, 2012 at 04:11:37PM -0400, Peter Watkins wrote:
> Note xfs_iget can be called while holding a locked agi buffer. If
> it goes into memory reclaim then inode teardown may try to lock the
> same buffer. Prevent the deadlock by calling radix_tree_preload
> with GFP_NOFS.
> 
> Signed-off-by: Peter Watkins <treestem@gmail.com>

This might be one for the stable kernel as well. Ben, can you add a
"cc: stable@vger.kernel.org" to the commit message for this one?

> ---
>  fs/xfs/xfs_iget.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
> index bcc6c24..8c6f806 100644
> --- a/fs/xfs/xfs_iget.c
> +++ b/fs/xfs/xfs_iget.c
> @@ -334,9 +334,10 @@ xfs_iget_cache_miss(
>  	/*
>  	 * Preload the radix tree so we can insert safely under the
>  	 * write spinlock. Note that we cannot sleep inside the preload
> -	 * region.
> +	 * region. Since we can be called from transaction context, don't
> +	 * recurse into the file system.
>  	 */
> -	if (radix_tree_preload(GFP_KERNEL)) {
> +	if (radix_tree_preload(GFP_NOFS)) {
>  		error = EAGAIN;
>  		goto out_destroy;
>  	}

Looks good. Thanks for the quick turn-around, Peter.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

      reply	other threads:[~2012-05-07 23:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04 21:55 deadlock below xfs_ialloc, when radix_tree_preload goes into reclaim? Peter Watkins
2012-05-05 23:31 ` Dave Chinner
2012-05-07 20:11 ` [PATCH] xfs: fix memory reclaim deadlock on agi buffer Peter Watkins
2012-05-07 23:18   ` Dave Chinner [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=20120507231838.GB5091@dastard \
    --to=david@fromorbit.com \
    --cc=treestem@gmail.com \
    --cc=xfs@oss.sgi.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