aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-04-30 10:10:36 -0400
committerMike Snitzer <snitzer@redhat.com>2015-04-30 10:25:21 -0400
commit3e6180f0c82b3790a9ec6d13d67aae359bf1ce84 (patch)
treec4abf15202b194c0762f97af185e4b40387413ac
parentb787f68c36d49bb1d9236f403813641efa74a031 (diff)
dm: only initialize the request_queue once
Commit bfebd1cdb4 ("dm: add full blk-mq support to request-based DM") didn't properly account for the need to short-circuit re-initializing DM's blk-mq request_queue if it was already initialized. Otherwise, reloading a blk-mq request-based DM table (either manually or via multipathd) resulted in errors, see: https://www.redhat.com/archives/dm-devel/2015-April/msg00132.html Fix is to only initialize the request_queue on the initial table load (when the mapped_device type is assigned). This is better than having dm_init_request_based_blk_mq_queue() return early if the queue was already initialized because it elevates the constraint to a more meaningful location in DM core. As such the pre-existing early return in dm_init_request_based_queue() can now be removed. Fixes: bfebd1cdb4 ("dm: add full blk-mq support to request-based DM") Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r--drivers/md/dm-ioctl.c17
-rw-r--r--drivers/md/dm.c3
2 files changed, 9 insertions, 11 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index c8a18e4ee9dc..720ceeb7fa9b 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1298,21 +1298,22 @@ static int table_load(struct dm_ioctl *param, size_t param_size)
1298 goto err_unlock_md_type; 1298 goto err_unlock_md_type;
1299 } 1299 }
1300 1300
1301 if (dm_get_md_type(md) == DM_TYPE_NONE) 1301 if (dm_get_md_type(md) == DM_TYPE_NONE) {
1302 /* Initial table load: acquire type of table. */ 1302 /* Initial table load: acquire type of table. */
1303 dm_set_md_type(md, dm_table_get_type(t)); 1303 dm_set_md_type(md, dm_table_get_type(t));
1304 else if (dm_get_md_type(md) != dm_table_get_type(t)) { 1304
1305 /* setup md->queue to reflect md's type (may block) */
1306 r = dm_setup_md_queue(md);
1307 if (r) {
1308 DMWARN("unable to set up device queue for new table.");
1309 goto err_unlock_md_type;
1310 }
1311 } else if (dm_get_md_type(md) != dm_table_get_type(t)) {
1305 DMWARN("can't change device type after initial table load."); 1312 DMWARN("can't change device type after initial table load.");
1306 r = -EINVAL; 1313 r = -EINVAL;
1307 goto err_unlock_md_type; 1314 goto err_unlock_md_type;
1308 } 1315 }
1309 1316
1310 /* setup md->queue to reflect md's type (may block) */
1311 r = dm_setup_md_queue(md);
1312 if (r) {
1313 DMWARN("unable to set up device queue for new table.");
1314 goto err_unlock_md_type;
1315 }
1316 dm_unlock_md_type(md); 1317 dm_unlock_md_type(md);
1317 1318
1318 /* stage inactive table */ 1319 /* stage inactive table */
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index f8c7ca3e8947..923496ba72a0 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2662,9 +2662,6 @@ static int dm_init_request_based_queue(struct mapped_device *md)
2662{ 2662{
2663 struct request_queue *q = NULL; 2663 struct request_queue *q = NULL;
2664 2664
2665 if (md->queue->elevator)
2666 return 0;
2667
2668 /* Fully initialize the queue */ 2665 /* Fully initialize the queue */
2669 q = blk_init_allocated_queue(md->queue, dm_request_fn, NULL); 2666 q = blk_init_allocated_queue(md->queue, dm_request_fn, NULL);
2670 if (!q) 2667 if (!q)