[dm-devel] [PATCH 7/7] dm-mpath: Fix a race condition in __multipath_map()

Mike Snitzer snitzer at redhat.com
Wed Nov 23 18:50:40 UTC 2016


On Wed, Nov 23 2016 at  1:28pm -0500,
Bart Van Assche <bart.vanassche at sandisk.com> wrote:

> On 11/22/2016 07:16 PM, Mike Snitzer wrote:
> >Anyway, this _untested_ patch should hopefully resolve the 'all_blk_mq'
> >inconsistency you saw:
> >
> >diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
> >index 8b013ea..8ce81d0 100644
> >--- a/drivers/md/dm-table.c
> >+++ b/drivers/md/dm-table.c
> >@@ -924,12 +924,6 @@ static int dm_table_determine_type(struct dm_table *t)
> >
> > 	BUG_ON(!request_based); /* No targets in this table */
> >
> >-	if (list_empty(devices) && __table_type_request_based(live_md_type)) {
> >-		/* inherit live MD type */
> >-		t->type = live_md_type;
> >-		return 0;
> >-	}
> >-
> > 	/*
> > 	 * The only way to establish DM_TYPE_MQ_REQUEST_BASED is by
> > 	 * having a compatible target use dm_table_set_type.
> >@@ -948,6 +942,19 @@ static int dm_table_determine_type(struct dm_table *t)
> > 		return -EINVAL;
> > 	}
> >
> >+	if (list_empty(devices)) {
> >+		int srcu_idx;
> >+		struct dm_table *live_table = dm_get_live_table(t->md, &srcu_idx);
> >+
> >+		/* inherit live table's type and all_blk_mq */
> >+		if (live_table) {
> >+			t->type = live_table->type;
> >+			t->all_blk_mq = live_table->all_blk_mq;
> >+		}
> >+		dm_put_live_table(t->md, srcu_idx);
> >+		return 0;
> >+	}
> >+
> > 	/* Non-request-stackable devices can't be used for request-based dm */
> > 	list_for_each_entry(dd, devices, list) {
> > 		struct request_queue *q = bdev_get_queue(dd->dm_dev->bdev);
> >
> 
> Hello Mike,
> 
> Thanks for the patch. This patch works fine on my test setup. This
> means that WARN_ON_ONCE(clone && q->mq_ops) is no longer triggered.

Thanks for testing.  I'll get it staged for 4.10 inclusion and marked
for stable.




More information about the dm-devel mailing list