Skip to content

Commit bf9ae8c

Browse files
committed
blk-mq: fix bad clear of RQF_MQ_INFLIGHT in blk_mq_ct_ctx_init()
A previous commit moved the clearing of rq->rq_flags later, but we may have already set RQF_MQ_INFLIGHT when that happens. Ensure that we correctly initialize rq->rq_flags to the right value. This is based on an original fix by Ming, just rewritten to not require a conditional. Fixes: 7c3fb70 ("block: rearrange a few request fields for better cache layout") Reviewed-by: Mike Snitzer <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 85ba3ef commit bf9ae8c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

block/blk-mq.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,14 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
269269
{
270270
struct blk_mq_tags *tags = blk_mq_tags_from_data(data);
271271
struct request *rq = tags->static_rqs[tag];
272+
req_flags_t rq_flags = 0;
272273

273274
if (data->flags & BLK_MQ_REQ_INTERNAL) {
274275
rq->tag = -1;
275276
rq->internal_tag = tag;
276277
} else {
277278
if (blk_mq_tag_busy(data->hctx)) {
278-
rq->rq_flags = RQF_MQ_INFLIGHT;
279+
rq_flags = RQF_MQ_INFLIGHT;
279280
atomic_inc(&data->hctx->nr_active);
280281
}
281282
rq->tag = tag;
@@ -286,7 +287,7 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data,
286287
/* csd/requeue_work/fifo_time is initialized before use */
287288
rq->q = data->q;
288289
rq->mq_ctx = data->ctx;
289-
rq->rq_flags = 0;
290+
rq->rq_flags = rq_flags;
290291
rq->cpu = -1;
291292
rq->cmd_flags = op;
292293
if (data->flags & BLK_MQ_REQ_PREEMPT)

0 commit comments

Comments
 (0)