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 <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
Tested-by: Yi Zhang <[email protected]>
Cc: Chao Leng <[email protected]>
Cc: Sagi Grimberg <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
Ming Lei
2020-10-30 08:33:49 -06:00
committed by Jens Axboe
parent 1f41be7d4e
commit 65ff5cd045
+1
View File
@@ -225,6 +225,7 @@ static void flush_end_io(struct request *flush_rq, blk_status_t error)
/* release the tag's ownership to the req cloned from */
spin_lock_irqsave(&fq->mq_flush_lock, flags);
WRITE_ONCE(flush_rq->state, MQ_RQ_IDLE);
if (!refcount_dec_and_test(&flush_rq->ref)) {
fq->rq_status = error;
spin_unlock_irqrestore(&fq->mq_flush_lock, flags);