linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-mq: mark flush request as IDLE in flush_end_io()
@ 2020-10-30  2:42 Ming Lei
  2020-10-30 14:33 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Ming Lei @ 2020-10-30  2:42 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei, Chao Leng, Sagi Grimberg, Yi Zhang

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(+)

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);
-- 
2.25.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] blk-mq: mark flush request as IDLE in flush_end_io()
  2020-10-30  2:42 [PATCH] blk-mq: mark flush request as IDLE in flush_end_io() Ming Lei
@ 2020-10-30 14:33 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-10-30 14:33 UTC (permalink / raw)
  To: Ming Lei; +Cc: linux-block, Chao Leng, Sagi Grimberg, Yi Zhang

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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-30 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30  2:42 [PATCH] blk-mq: mark flush request as IDLE in flush_end_io() Ming Lei
2020-10-30 14:33 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).