aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-barrier.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/blk-barrier.c')
-rw-r--r--block/blk-barrier.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c
index eefbde835308..557f69360b6a 100644
--- a/block/blk-barrier.c
+++ b/block/blk-barrier.c
@@ -310,6 +310,15 @@ int blkdev_issue_flush(struct block_device *bdev, gfp_t gfp_mask,
310 if (!q) 310 if (!q)
311 return -ENXIO; 311 return -ENXIO;
312 312
313 /*
314 * some block devices may not have their queue correctly set up here
315 * (e.g. loop device without a backing file) and so issuing a flush
316 * here will panic. Ensure there is a request function before issuing
317 * the barrier.
318 */
319 if (!q->make_request_fn)
320 return -ENXIO;
321
313 bio = bio_alloc(gfp_mask, 0); 322 bio = bio_alloc(gfp_mask, 0);
314 bio->bi_end_io = bio_end_empty_barrier; 323 bio->bi_end_io = bio_end_empty_barrier;
315 bio->bi_bdev = bdev; 324 bio->bi_bdev = bdev;