dm rq: fix the starting and stopping of blk-mq queues
authorMike Snitzer <snitzer@redhat.com>
Tue, 2 Aug 2016 16:51:11 +0000 (12:51 -0400)
committerMike Snitzer <snitzer@redhat.com>
Tue, 2 Aug 2016 20:21:36 +0000 (16:21 -0400)
commit7d9595d848cdff5c7939f68eec39e0c5d36a1d67
tree7c67e749ebd0d30db067ed41e18fde8fdc34a0d0
parent1814f2e3fb95b58490e56a38fefe462ffe8fb9ad
dm rq: fix the starting and stopping of blk-mq queues

Improve dm_stop_queue() to cancel any requeue_work.  Also, have
dm_start_queue() and dm_stop_queue() clear/set the QUEUE_FLAG_STOPPED
for the blk-mq request_queue.

On suspend dm_stop_queue() handles stopping the blk-mq request_queue
BUT: even though the hw_queues are marked BLK_MQ_S_STOPPED at that point
there is still a race that is allowing block/blk-mq.c to call ->queue_rq
against a hctx that it really shouldn't.  Add a check to
dm_mq_queue_rq() that guards against this rarity (albeit _not_
race-free).

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # must patch dm.c on < 4.8 kernels
drivers/md/dm-rq.c