From: Peter Watkins Date: Mon, 7 May 2012 20:11:37 +0000 (-0400) Subject: xfs: fix memory reclaim deadlock on agi buffer X-Git-Tag: upstream/snapshot3+hdmi~7385^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3ba316037470bbf98c8a16c2179c02794fb8862e;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Reviewed-by: Dave Chinner Signed-off-by: Ben Myers --- diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 7f81397..1bb4365 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; }