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: 568f27006577 ("blk-mq: centralise related handling into blk_mq_get_driver_tag")
Reported-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Tested-by: Matthew Wilcox <willy@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by Ming Lei and committed by Jens Axboe c1e2b842 fe6a8fc5

Changed files
+9 -2
block
+9 -2
block/blk-flush.c
··· 308 308 flush_rq->mq_ctx = first_rq->mq_ctx; 309 309 flush_rq->mq_hctx = first_rq->mq_hctx; 310 310 311 - if (!q->elevator) 311 + if (!q->elevator) { 312 312 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 314 321 flush_rq->internal_tag = first_rq->internal_tag; 315 322 316 323 flush_rq->cmd_flags = REQ_OP_FLUSH | REQ_PREFLUSH;