xfs
[Top] [All Lists]

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

To: david@xxxxxxxxxxxxx
Subject: [PATCH] xfs: fix memory reclaim deadlock on agi buffer
From: Peter Watkins <treestem@xxxxxxxxx>
Date: Mon, 7 May 2012 16:11:37 -0400
Cc: xfs@xxxxxxxxxxx, Peter Watkins <treestem@xxxxxxxxx>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=/kud44Sg17ialEA0Spg4HJeSh68zgpFsVjEeuV0YywM=; b=heDLzXKzf5f4WXhlzfcmHPi7pp1IX8Mg6tLIYR5HnQ3kGNtBHtfOqsuN8F2nlfElFV Z/aaaJK41DWbIendNEHqfH46PpzLYVN0bFQgh6htdR5ay6eIC0pv4pfxnkZVOvY7vprl rBHSgS27oS1b5G9dA1vRFzSYxKWW7RPAVeZVnOcP9KQcvyaVrG7yd3DPOu3uH7GKoyXH QBzzrfMITjuvsvG9n0x7vmVZ8+1LLeOSixa53s7QJV8cNyzz1SKhkj8GW7rVvL9QJPHH BkDzNkGXppZruZlYBm0zjTCw1bhzyk9gCo2a8uqGtGCe+TFEBYfBBKhqY2ITZeF+E3pu 6gVg==
In-reply-to: <CAH4wwdHb0=9UtTiwz-fAYovXGO6J8soda31S+dgCGNKBA3j5sw@xxxxxxxxxxxxxx>
References: <CAH4wwdHb0=9UtTiwz-fAYovXGO6J8soda31S+dgCGNKBA3j5sw@xxxxxxxxxxxxxx>
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>
---
 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;
        }
-- 
1.7.0.4

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