Skip to content

Commit

Permalink
xfs: fix memory reclaim deadlock on agi buffer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Watkins authored and Ben Myers committed May 21, 2012
1 parent ea562ed commit 3ba3160
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/xfs/xfs_iget.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 3ba3160

Please sign in to comment.