xfs: fix memory reclaim deadlock on agi buffer

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>
This commit is contained in:
Peter Watkins 2012-05-07 16:11:37 -04:00 committed by Ben Myers
parent ea562ed6e7
commit 3ba3160374
1 changed files with 3 additions and 2 deletions

View 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;
}