diff mbox series

blk-mq: mark flush request as IDLE in flush_end_io()

Message ID 20201030024253.2025932-1-ming.lei@redhat.com (mailing list archive)
State New, archived
Headers show
Series blk-mq: mark flush request as IDLE in flush_end_io() | expand

Commit Message

Ming Lei Oct. 30, 2020, 2:42 a.m. UTC
Mark flush request as IDLE in its .end_io() for aligning to normal request since
flush request stays in in-flight tags in case of !elevator, 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 request's state is kept as COMPLETE.

Cc: Chao Leng <lengchao@huawei.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/blk-flush.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jens Axboe Oct. 30, 2020, 2:33 p.m. UTC | #1
On 10/29/20 8:42 PM, Ming Lei wrote:
> Mark flush request as IDLE in its .end_io() for aligning to normal request since
> flush request stays in in-flight tags in case of !elevator, 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 request's state is kept as COMPLETE.

Applied, thanks.
diff mbox series

Patch

diff --git a/block/blk-flush.c b/block/blk-flush.c
index 53abb5c73d99..e32958f0b687 100644
--- a/block/blk-flush.c
+++ b/block/blk-flush.c
@@ -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);