xfs
[Top] [All Lists]

[PATCH 089/102] xfs: fix memory reclaim deadlock on agi buffer

To: xfs@xxxxxxxxxxx
Subject: [PATCH 089/102] xfs: fix memory reclaim deadlock on agi buffer
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 23 Aug 2012 15:02:47 +1000
In-reply-to: <1345698180-13612-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1345698180-13612-1-git-send-email-david@xxxxxxxxxxxxx>
From: Peter Watkins <treestem@xxxxxxxxx>

Upstream commit: 3ba316037470bbf98c8a16c2179c02794fb8862e

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>
Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>
Signed-off-by: Ben Myers <bpm@xxxxxxx>
---
 fs/xfs/xfs_iget.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 35b1f7b..a3663a8 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -337,9 +337,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;
        }
-- 
1.7.10

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