mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
dm-table: fix checking for rq stackable devices
Due to the semantics of iterate_devices(), the current code allows a request-based dm table as long as it includes one request-stackable device. It is supposed to only allow tables where there are no non-request-stackable devices. Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Reviewed-by: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
This commit is contained in:
parent
86731a2a65
commit
8ca719b819
|
|
@ -899,17 +899,17 @@ static bool dm_table_supports_dax(struct dm_table *t,
|
|||
return true;
|
||||
}
|
||||
|
||||
static int device_is_rq_stackable(struct dm_target *ti, struct dm_dev *dev,
|
||||
sector_t start, sector_t len, void *data)
|
||||
static int device_is_not_rq_stackable(struct dm_target *ti, struct dm_dev *dev,
|
||||
sector_t start, sector_t len, void *data)
|
||||
{
|
||||
struct block_device *bdev = dev->bdev;
|
||||
struct request_queue *q = bdev_get_queue(bdev);
|
||||
|
||||
/* request-based cannot stack on partitions! */
|
||||
if (bdev_is_partition(bdev))
|
||||
return false;
|
||||
return true;
|
||||
|
||||
return queue_is_mq(q);
|
||||
return !queue_is_mq(q);
|
||||
}
|
||||
|
||||
static int dm_table_determine_type(struct dm_table *t)
|
||||
|
|
@ -1005,7 +1005,7 @@ static int dm_table_determine_type(struct dm_table *t)
|
|||
|
||||
/* Non-request-stackable devices can't be used for request-based dm */
|
||||
if (!ti->type->iterate_devices ||
|
||||
!ti->type->iterate_devices(ti, device_is_rq_stackable, NULL)) {
|
||||
ti->type->iterate_devices(ti, device_is_not_rq_stackable, NULL)) {
|
||||
DMERR("table load rejected: including non-request-stackable devices");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user