[dm-devel] [PATCH 8/9] dm: Fix two race conditions related to stopping and starting queues
Bart Van Assche
Bart.VanAssche at sandisk.com
Thu Sep 1 14:23:31 UTC 2016
On 08/31/16 20:14, Mike Snitzer wrote:
> On Wed, Aug 31 2016 at 6:18pm -0400,
> Bart Van Assche <bart.vanassche at sandisk.com> wrote:
>
>> Ensure that all ongoing dm_mq_queue_rq() and dm_mq_requeue_request()
>> calls have stopped before setting the "queue stopped" flag. This
>> allows to remove the "queue stopped" test from dm_mq_queue_rq() and
>> dm_mq_requeue_request(). Use BLK_MQ_S_STOPPED instead of
>> QUEUE_FLAG_STOPPED.
>
> At first glance, at a minimum this patch needs a better header. It
> seems you're doing 2 things:
>
> 1) using blk_mq_{freeze,unfreeze}_queue() actually makes dm_stop_queue()
> work for blk-mq? Whereby fixing blk-mq race(s)?
>
> 2) switching away from QUEUE_FLAG_STOPPED to BLK_MQ_S_STOPPED (via
> blk_mq_queue_stopped)
> - not clear to me that dm-mq's use of QUEUE_FLAG_STOPPED wasn't fine;
> NVMe also uses it for blk-mq
Hello Mike,
Adding the blk_mq_{freeze,unfreeze}_queue() calls is indeed what fixes
the race conditions related to stopping dm queues and what makes
dm_stop_queue() work.
If other blk-mq users and developers agree that QUEUE_FLAG_STOPPED
should be set for stopped blk-mq queues then I think the code to set
that flag should be moved into the blk-mq core. However, setting that
flag for blk-mq queues seems redundant to me. Hence my proposal to
introduce blk_mq_queue_stopped() instead.
Bart.
More information about the dm-devel
mailing list