@@ -1736,9 +1736,12 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
if (rq->mq_hctx != this_hctx || rq->mq_ctx != this_ctx) {
if (this_hctx) {
trace_block_unplug(this_q, depth, !from_schedule);
+
+ percpu_ref_get(&this_q->q_usage_counter);
blk_mq_sched_insert_requests(this_hctx, this_ctx,
&rq_list,
from_schedule);
+ percpu_ref_put(&this_q->q_usage_counter);
}
this_q = rq->q;
@@ -1757,8 +1760,11 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
*/
if (this_hctx) {
trace_block_unplug(this_q, depth, !from_schedule);
+
+ percpu_ref_get(&this_q->q_usage_counter);
blk_mq_sched_insert_requests(this_hctx, this_ctx, &rq_list,
from_schedule);
+ percpu_ref_put(&this_q->q_usage_counter);
}
}