xfs: switch to NOFS allocation under i_lock in xfs_getbmap
authorChristoph Hellwig <hch@infradead.org>
Sat, 18 Jul 2009 22:14:54 +0000 (18:14 -0400)
committerFelix Blyakher <felixb@sgi.com>
Wed, 12 Aug 2009 06:06:59 +0000 (01:06 -0500)
xfs_getbmap allocates memory with i_lock held, but i_lock is taken in
reclaim context so all allocations under it must avoid recursions into
the filesystem.

Reported by the new reclaim context tracing in lockdep.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Felix Blyakher <felixb@sgi.com>
Signed-off-by: Felix Blyakher <felixb@sgi.com>
fs/xfs/xfs_bmap.c

index 7928b99..8ee5b5a 100644 (file)
@@ -6009,7 +6009,7 @@ xfs_getbmap(
         */
        error = ENOMEM;
        subnex = 16;
-       map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL);
+       map = kmem_alloc(subnex * sizeof(*map), KM_MAYFAIL | KM_NOFS);
        if (!map)
                goto out_unlock_ilock;