Skip to content

Commit 98b26a0

Browse files
committed
block: call rq_qos_done() before ref check in batch completions
We need to call rq_qos_done() regardless of whether or not we're freeing the request or not, as the reference count doesn't cover the IO completion tracking. Fixes: f794f33 ("block: add support for blk_mq_end_request_batch()") Reported-by: Shinichiro Kawasaki <[email protected]> Reported-by: Kenneth R. Crudup <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent e30028a commit 98b26a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

block/blk-mq.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,13 +860,14 @@ void blk_mq_end_request_batch(struct io_comp_batch *iob)
860860
if (iob->need_ts)
861861
__blk_mq_end_request_acct(rq, now);
862862

863+
rq_qos_done(rq->q, rq);
864+
863865
WRITE_ONCE(rq->state, MQ_RQ_IDLE);
864866
if (!refcount_dec_and_test(&rq->ref))
865867
continue;
866868

867869
blk_crypto_free_request(rq);
868870
blk_pm_mark_last_busy(rq);
869-
rq_qos_done(rq->q, rq);
870871

871872
if (nr_tags == TAG_COMP_BATCH || cur_hctx != rq->mq_hctx) {
872873
if (cur_hctx)

0 commit comments

Comments
 (0)