Skip to content

Commit a57a178

Browse files
Christoph Hellwigaxboe
authored andcommitted
blk-mq: avoid infinite recursion with the FUA flag
We should not insert requests into the flush state machine from blk_mq_insert_request. All incoming flush requests come through blk_{m,s}q_make_request and are handled there, while blk_execute_rq_nowait should only be called for BLOCK_PC requests. All other callers deal with requests that already went through the flush statemchine and shouldn't be reinserted into it. Reported-by: Robert Elliott <Elliott@hp.com> Debugged-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
1 parent 683d0e1 commit a57a178

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

‎block/blk-exec.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
5656
bool is_pm_resume;
5757

5858
WARN_ON(irqs_disabled());
59+
WARN_ON(rq->cmd_type == REQ_TYPE_FS);
5960

6061
rq->rq_disk = bd_disk;
6162
rq->end_io = done;

‎block/blk-mq.c‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -963,14 +963,9 @@ void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue,
963963

964964
hctx = q->mq_ops->map_queue(q, ctx->cpu);
965965

966-
if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA) &&
967-
!(rq->cmd_flags & (REQ_FLUSH_SEQ))) {
968-
blk_insert_flush(rq);
969-
} else {
970-
spin_lock(&ctx->lock);
971-
__blk_mq_insert_request(hctx, rq, at_head);
972-
spin_unlock(&ctx->lock);
973-
}
966+
spin_lock(&ctx->lock);
967+
__blk_mq_insert_request(hctx, rq, at_head);
968+
spin_unlock(&ctx->lock);
974969

975970
if (run_queue)
976971
blk_mq_run_hw_queue(hctx, async);

0 commit comments

Comments
 (0)