On Tue, Sep 08, 2020 at 04:15:36PM +0800, Ming Lei wrote: > void blk_mq_quiesce_queue(struct request_queue *q) > { > - struct blk_mq_hw_ctx *hctx; > - unsigned int i; > - bool rcu = false; > + bool blocking = !!(q->tag_set->flags & BLK_MQ_F_BLOCKING); > > mutex_lock(&q->mq_quiesce_lock); > > - if (blk_queue_quiesced(q)) > - goto exit; Why remove the 'goto exit' on this condition? There shouldn't be a need to synchronize dispatch again if a previous quiesce already did so. > - blk_mq_quiesce_queue_nowait(q); > - > - queue_for_each_hw_ctx(q, hctx, i) { > - if (hctx->flags & BLK_MQ_F_BLOCKING) > - synchronize_srcu(hctx->srcu); > - else > - rcu = true; > + if (!blk_queue_quiesced(q)) { > + blk_mq_quiesce_queue_nowait(q); > + if (blocking) > + percpu_ref_kill(&q->dispatch_counter); > } > - if (rcu) > + > + if (blocking) > + wait_event(q->mq_quiesce_wq, > + percpu_ref_is_zero(&q->dispatch_counter)); > + else > synchronize_rcu(); > - exit: > + > mutex_unlock(&q->mq_quiesce_lock); > }