xfs
[Top] [All Lists]

Re: [PATCH] xfs: fix memory reclaim deadlock on agi buffer

To: Peter Watkins <treestem@xxxxxxxxx>
Subject: Re: [PATCH] xfs: fix memory reclaim deadlock on agi buffer
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Tue, 8 May 2012 09:18:38 +1000
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1336421497-1554-1-git-send-email-treestem@xxxxxxxxx>
References: <CAH4wwdHb0=9UtTiwz-fAYovXGO6J8soda31S+dgCGNKBA3j5sw@xxxxxxxxxxxxxx> <1336421497-1554-1-git-send-email-treestem@xxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
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@xxxxxxxxx>

This might be one for the stable kernel as well. Ben, can you add a
"cc: stable@xxxxxxxxxxxxxxx" 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@xxxxxxxxxx>

-- 
Dave Chinner
david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>