Commit 98b26a0e authored by Jens Axboe's avatar Jens Axboe

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: f794f335 ("block: add support for blk_mq_end_request_batch()")
Reported-by: default avatarShinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reported-by: default avatarKenneth R. Crudup <kenny@panix.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent e30028ac
...@@ -860,13 +860,14 @@ void blk_mq_end_request_batch(struct io_comp_batch *iob) ...@@ -860,13 +860,14 @@ void blk_mq_end_request_batch(struct io_comp_batch *iob)
if (iob->need_ts) if (iob->need_ts)
__blk_mq_end_request_acct(rq, now); __blk_mq_end_request_acct(rq, now);
rq_qos_done(rq->q, rq);
WRITE_ONCE(rq->state, MQ_RQ_IDLE); WRITE_ONCE(rq->state, MQ_RQ_IDLE);
if (!refcount_dec_and_test(&rq->ref)) if (!refcount_dec_and_test(&rq->ref))
continue; continue;
blk_crypto_free_request(rq); blk_crypto_free_request(rq);
blk_pm_mark_last_busy(rq); blk_pm_mark_last_busy(rq);
rq_qos_done(rq->q, rq);
if (nr_tags == TAG_COMP_BATCH || cur_hctx != rq->mq_hctx) { if (nr_tags == TAG_COMP_BATCH || cur_hctx != rq->mq_hctx) {
if (cur_hctx) if (cur_hctx)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment