Skip to content

Commit 0c2322e

Browse files
committed
dm: detect lost queue
Detect and report buggy drivers that destroy their request_queue. Signed-off-by: Alasdair G Kergon <[email protected]> Cc: Stefan Raspl <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Andrew Morton <[email protected]>
1 parent 5416090 commit 0c2322e

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

drivers/md/dm-table.c

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,13 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
482482
{
483483
struct request_queue *q = bdev_get_queue(bdev);
484484
struct io_restrictions *rs = &ti->limits;
485+
char b[BDEVNAME_SIZE];
486+
487+
if (unlikely(!q)) {
488+
DMWARN("%s: Cannot set limits for nonexistent device %s",
489+
dm_device_name(ti->table->md), bdevname(bdev, b));
490+
return;
491+
}
485492

486493
/*
487494
* Combine the device limits low.
@@ -950,7 +957,14 @@ int dm_table_any_congested(struct dm_table *t, int bdi_bits)
950957

951958
list_for_each_entry(dd, devices, list) {
952959
struct request_queue *q = bdev_get_queue(dd->dm_dev.bdev);
953-
r |= bdi_congested(&q->backing_dev_info, bdi_bits);
960+
char b[BDEVNAME_SIZE];
961+
962+
if (likely(q))
963+
r |= bdi_congested(&q->backing_dev_info, bdi_bits);
964+
else
965+
DMWARN_LIMIT("%s: any_congested: nonexistent device %s",
966+
dm_device_name(t->md),
967+
bdevname(dd->dm_dev.bdev, b));
954968
}
955969

956970
return r;
@@ -963,8 +977,14 @@ void dm_table_unplug_all(struct dm_table *t)
963977

964978
list_for_each_entry(dd, devices, list) {
965979
struct request_queue *q = bdev_get_queue(dd->dm_dev.bdev);
966-
967-
blk_unplug(q);
980+
char b[BDEVNAME_SIZE];
981+
982+
if (likely(q))
983+
blk_unplug(q);
984+
else
985+
DMWARN_LIMIT("%s: Cannot unplug nonexistent device %s",
986+
dm_device_name(t->md),
987+
bdevname(dd->dm_dev.bdev, b));
968988
}
969989
}
970990

0 commit comments

Comments
 (0)