Patch "blk-mq: don't count completed flush data request as inflight in case of quiesce" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    blk-mq: don't count completed flush data request as inflight in case of quiesce

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     blk-mq-don-t-count-completed-flush-data-request-as-i.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 12a126a876bfcbf809017ff78b8f0556203f4492
Author: Ming Lei <ming.lei@xxxxxxxxxx>
Date:   Fri Dec 1 16:56:05 2023 +0800

    blk-mq: don't count completed flush data request as inflight in case of quiesce
    
    [ Upstream commit 0e4237ae8d159e3d28f3cd83146a46f576ffb586 ]
    
    Request queue quiesce may interrupt flush sequence, and the original request
    may have been marked as COMPLETE, but can't get finished because of
    queue quiesce.
    
    This way is fine from driver viewpoint, because flush sequence is block
    layer concept, and it isn't related with driver.
    
    However, driver(such as dm-rq) can call blk_mq_queue_inflight() to count &
    drain inflight requests, then the wait & drain never gets done because
    the completed & not-finished flush request is counted as inflight.
    
    Fix this issue by not counting completed flush data request as inflight in
    case of quiesce.
    
    Cc: Mike Snitzer <snitzer@xxxxxxxxxx>
    Cc: David Jeffery <djeffery@xxxxxxxxxx>
    Cc: John Pittman <jpittman@xxxxxxxxxx>
    Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20231201085605.577730-1-ming.lei@xxxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 6ab7f360ff2a..20ecd0ab616f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1511,14 +1511,26 @@ void blk_mq_delay_kick_requeue_list(struct request_queue *q,
 }
 EXPORT_SYMBOL(blk_mq_delay_kick_requeue_list);
 
+static bool blk_is_flush_data_rq(struct request *rq)
+{
+	return (rq->rq_flags & RQF_FLUSH_SEQ) && !is_flush_rq(rq);
+}
+
 static bool blk_mq_rq_inflight(struct request *rq, void *priv)
 {
 	/*
 	 * If we find a request that isn't idle we know the queue is busy
 	 * as it's checked in the iter.
 	 * Return false to stop the iteration.
+	 *
+	 * In case of queue quiesce, if one flush data request is completed,
+	 * don't count it as inflight given the flush sequence is suspended,
+	 * and the original flush data request is invisible to driver, just
+	 * like other pending requests because of quiesce
 	 */
-	if (blk_mq_request_started(rq)) {
+	if (blk_mq_request_started(rq) && !(blk_queue_quiesced(rq->q) &&
+				blk_is_flush_data_rq(rq) &&
+				blk_mq_request_completed(rq))) {
 		bool *busy = priv;
 
 		*busy = true;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux