Keith,
Is the following solution OK?
synchronize_rcu guarantee that no queue_rq is running concurrently with device disable code.
Together with your another patch (adding blk_sync_queue), both sync/async path shall be handled correctly.
Do you think synchronize_rcu shall be added to blk_sync_queue?
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4c0622f..bfe9132 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -865,7 +865,9 @@ void blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx, bool async)
if (!async) {
int cpu = get_cpu();
if (cpumask_test_cpu(cpu, hctx->cpumask)) {
+ rcu_read_lock();
__blk_mq_run_hw_queue(hctx);
+ rcu_read_unlock();