Skip to content

Commit c1e2b84

Browse files
Ming Leiaxboe
authored andcommitted
block: fix double account of flush request's driver tag
In case of none scheduler, we share data request's driver tag for flush request, so have to mark the flush request as INFLIGHT for avoiding double account of this driver tag. Fixes: 568f270 ("blk-mq: centralise related handling into blk_mq_get_driver_tag") Reported-by: Matthew Wilcox <[email protected]> Signed-off-by: Ming Lei <[email protected]> Tested-by: Matthew Wilcox <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent fe6a8fc commit c1e2b84

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

block/blk-flush.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,16 @@ static void blk_kick_flush(struct request_queue *q, struct blk_flush_queue *fq,
308308
flush_rq->mq_ctx = first_rq->mq_ctx;
309309
flush_rq->mq_hctx = first_rq->mq_hctx;
310310

311-
if (!q->elevator)
311+
if (!q->elevator) {
312312
flush_rq->tag = first_rq->tag;
313-
else
313+
314+
/*
315+
* We borrow data request's driver tag, so have to mark
316+
* this flush request as INFLIGHT for avoiding double
317+
* account of this driver tag
318+
*/
319+
flush_rq->rq_flags |= RQF_MQ_INFLIGHT;
320+
} else
314321
flush_rq->internal_tag = first_rq->internal_tag;
315322

316323
flush_rq->cmd_flags = REQ_OP_FLUSH | REQ_PREFLUSH;

0 commit comments

Comments
 (0)