]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
xfs: fix memory reclaim deadlock on agi buffer
authorPeter Watkins <treestem@gmail.com>
Mon, 7 May 2012 20:11:37 +0000 (16:11 -0400)
committerBen Myers <bpm@sgi.com>
Mon, 21 May 2012 15:45:44 +0000 (10:45 -0500)
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>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_iget.c

index 7f81397eeec26d5445c067db9ac6d44c0e34c0da..1bb4365e8c25470d8686996401d7996ce1d3b244 100644 (file)
@@ -317,9 +317,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;
        }