Skip to content

Commit

Permalink
blk-mq: avoid infinite recursion with the FUA flag
Browse files Browse the repository at this point in the history
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  <[email protected]>
Debugged-by: Ming Lei <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and axboe committed Sep 22, 2014
1 parent 683d0e1 commit a57a178
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions block/blk-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ void blk_execute_rq_nowait(struct request_queue *q, struct gendisk *bd_disk,
bool is_pm_resume;

WARN_ON(irqs_disabled());
WARN_ON(rq->cmd_type == REQ_TYPE_FS);

rq->rq_disk = bd_disk;
rq->end_io = done;
Expand Down
11 changes: 3 additions & 8 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -963,14 +963,9 @@ void blk_mq_insert_request(struct request *rq, bool at_head, bool run_queue,

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

if (rq->cmd_flags & (REQ_FLUSH | REQ_FUA) &&
!(rq->cmd_flags & (REQ_FLUSH_SEQ))) {
blk_insert_flush(rq);
} else {
spin_lock(&ctx->lock);
__blk_mq_insert_request(hctx, rq, at_head);
spin_unlock(&ctx->lock);
}
spin_lock(&ctx->lock);
__blk_mq_insert_request(hctx, rq, at_head);
spin_unlock(&ctx->lock);

if (run_queue)
blk_mq_run_hw_queue(hctx, async);
Expand Down

0 comments on commit a57a178

Please sign in to comment.