summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorPeter Watkins <treestem@gmail.com>2012-05-07 16:11:37 -0400
committerBen Myers <bpm@sgi.com>2012-05-21 10:45:44 -0500
commit3ba316037470bbf98c8a16c2179c02794fb8862e (patch)
treecd9a68a6f7ecefc76e7e66e21fd936a60a1e2b6f /fs/xfs
parentea562ed6e7df5acd9392d993882c39e855099165 (diff)
downloadlinux-3ba316037470bbf98c8a16c2179c02794fb8862e.tar.gz
linux-3ba316037470bbf98c8a16c2179c02794fb8862e.tar.bz2
linux-3ba316037470bbf98c8a16c2179c02794fb8862e.zip
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>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_iget.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c
index 7f81397eeec2..1bb4365e8c25 100644
--- a/fs/xfs/xfs_iget.c
+++ b/fs/xfs/xfs_iget.c
@@ -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;
}