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

Bart Van Assche bart.vanassche at sandisk.com
Wed Nov 23 18:28:50 UTC 2016


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.

Bart.




More information about the dm-devel mailing list