Skip to content

Commit 65ff5cd

Browse files
Ming Leiaxboe
authored andcommitted
blk-mq: mark flush request as IDLE in flush_end_io()
Mark flush request as IDLE in its .end_io(), aligning it with how normal requests behave. The flush request stays in in-flight tags if we're not using an IO scheduler, so we need to change its state into IDLE. Otherwise, we will hang in blk_mq_tagset_wait_completed_request() during error recovery because flush the request state is kept as COMPLETED. Reported-by: Yi Zhang <yi.zhang@redhat.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Tested-by: Yi Zhang <yi.zhang@redhat.com> Cc: Chao Leng <lengchao@huawei.com> Cc: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 1f41be7 commit 65ff5cd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

block/blk-flush.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
225225
/* release the tag's ownership to the req cloned from */
226226
spin_lock_irqsave(&fq->mq_flush_lock, flags);
227227

228+
WRITE_ONCE(flush_rq->state, MQ_RQ_IDLE);
228229
if (!refcount_dec_and_test(&flush_rq->ref)) {
229230
fq->rq_status = error;
230231
spin_unlock_irqrestore(&fq->mq_flush_lock, flags);

0 commit comments

Comments
 (0)