block: disallow FS recursion from sb_issue_discard allocation
authorMike Snitzer <snitzer@redhat.com>
Tue, 3 Aug 2010 10:54:51 +0000 (12:54 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Sat, 7 Aug 2010 16:53:04 +0000 (18:53 +0200)
Filesystems can call sb_issue_discard on a memory reclaim path
(e.g. ext4 calls sb_issue_discard during journal commit).

Use GFP_NOFS in sb_issue_discard to avoid recursing back into the FS.

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
include/linux/blkdev.h

index a8b05fc80c6dbb015a2f4d150ea4f98e0f1e8881..89c855c5655c8f2204e0dd0d263571d267a1c6ce 100644 (file)
@@ -933,7 +933,7 @@ static inline int sb_issue_discard(struct super_block *sb,
 {
        block <<= (sb->s_blocksize_bits - 9);
        nr_blocks <<= (sb->s_blocksize_bits - 9);
-       return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL,
+       return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_NOFS,
                                   BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
 }