@@ -482,6 +482,13 @@ void dm_set_device_limits(struct dm_target *ti, struct block_device *bdev)
482
482
{
483
483
struct request_queue * q = bdev_get_queue (bdev );
484
484
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
+ }
485
492
486
493
/*
487
494
* Combine the device limits low.
@@ -950,7 +957,14 @@ int dm_table_any_congested(struct dm_table *t, int bdi_bits)
950
957
951
958
list_for_each_entry (dd , devices , list ) {
952
959
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 ));
954
968
}
955
969
956
970
return r ;
@@ -963,8 +977,14 @@ void dm_table_unplug_all(struct dm_table *t)
963
977
964
978
list_for_each_entry (dd , devices , list ) {
965
979
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 ));
968
988
}
969
989
}
970
990
0 commit comments