public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: fix might_sleep() warning when initialising per-ag tree
@ 2010-05-27  1:58 Dave Chinner
  2010-05-27 12:21 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Chinner @ 2010-05-27  1:58 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

The use of radix_tree_preload() only works if the radix tree was initialised
without the __GFP_WAIT flag. The per-ag tree uses GFP_NOFS, so does not trigger
allocation of new tree nodes from the preloaded array. Hence it enters the
allocator with a spinlock held and triggers the might_sleep() warnings.

Reported-by; Chris Mason <chris.mason@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_mount.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index ace795f..c901283 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1251,7 +1251,7 @@ xfs_mountfs(
 	 * Allocate and initialize the per-ag data.
 	 */
 	spin_lock_init(&mp->m_perag_lock);
-	INIT_RADIX_TREE(&mp->m_perag_tree, GFP_NOFS);
+	INIT_RADIX_TREE(&mp->m_perag_tree, GFP_ATOMIC);
 	error = xfs_initialize_perag(mp, sbp->sb_agcount, &mp->m_maxagi);
 	if (error) {
 		cmn_err(CE_WARN, "XFS: Failed per-ag init: %d", error);
-- 
1.5.6.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: fix might_sleep() warning when initialising per-ag tree
  2010-05-27  1:58 [PATCH] xfs: fix might_sleep() warning when initialising per-ag tree Dave Chinner
@ 2010-05-27 12:21 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2010-05-27 12:21 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On Thu, May 27, 2010 at 11:58:13AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> The use of radix_tree_preload() only works if the radix tree was initialised
> without the __GFP_WAIT flag. The per-ag tree uses GFP_NOFS, so does not trigger
> allocation of new tree nodes from the preloaded array. Hence it enters the
> allocator with a spinlock held and triggers the might_sleep() warnings.
> 
> Reported-by; Chris Mason <chris.mason@oracle.com>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>

Looks good,


Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-27 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27  1:58 [PATCH] xfs: fix might_sleep() warning when initialising per-ag tree Dave Chinner
2010-05-27 12:21 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox