Patch "block/wbt: fix negative inflight counter when remove scsi device" has been added to the 5.15-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

    block/wbt: fix negative inflight counter when remove scsi device

to the 5.15-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:
     block-wbt-fix-negative-inflight-counter-when-remove-.patch
and it can be found in the queue-5.15 subdirectory.

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



commit 6bb521657c79f18e0f0ae0f05ead221303773087
Author: Laibin Qiu <qiulaibin@xxxxxxxxxx>
Date:   Sat Jan 22 19:10:45 2022 +0800

    block/wbt: fix negative inflight counter when remove scsi device
    
    [ Upstream commit e92bc4cd34de2ce454bdea8cd198b8067ee4e123 ]
    
    Now that we disable wbt by set WBT_STATE_OFF_DEFAULT in
    wbt_disable_default() when switch elevator to bfq. And when
    we remove scsi device, wbt will be enabled by wbt_enable_default.
    If it become false positive between wbt_wait() and wbt_track()
    when submit write request.
    
    The following is the scenario that triggered the problem.
    
    T1                          T2                           T3
                                elevator_switch_mq
                                bfq_init_queue
                                wbt_disable_default <= Set
                                rwb->enable_state (OFF)
    Submit_bio
    blk_mq_make_request
    rq_qos_throttle
    <= rwb->enable_state (OFF)
                                                             scsi_remove_device
                                                             sd_remove
                                                             del_gendisk
                                                             blk_unregister_queue
                                                             elv_unregister_queue
                                                             wbt_enable_default
                                                             <= Set rwb->enable_state (ON)
    q_qos_track
    <= rwb->enable_state (ON)
    ^^^^^^ this request will mark WBT_TRACKED without inflight add and will
    lead to drop rqw->inflight to -1 in wbt_done() which will trigger IO hung.
    
    Fix this by move wbt_enable_default() from elv_unregister to
    bfq_exit_queue(). Only re-enable wbt when bfq exit.
    
    Fixes: 76a8040817b4b ("blk-wbt: make sure throttle is enabled properly")
    
    Remove oneline stale comment, and kill one oneshot local variable.
    
    Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
    Reviewed-by: Christoph Hellwig <hch@xxxxxx>
    Link: https://lore.kernel.org/linux-block/20211214133103.551813-1-qiulaibin@xxxxxxxxxx/
    Signed-off-by: Laibin Qiu <qiulaibin@xxxxxxxxxx>
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c
index ea9a086d0498f..e66970bf27dbe 100644
--- a/block/bfq-iosched.c
+++ b/block/bfq-iosched.c
@@ -6878,6 +6878,8 @@ static void bfq_exit_queue(struct elevator_queue *e)
 	spin_unlock_irq(&bfqd->lock);
 #endif
 
+	wbt_enable_default(bfqd->queue);
+
 	kfree(bfqd);
 }
 
diff --git a/block/elevator.c b/block/elevator.c
index cd02ae332c4eb..1b5e57f6115f3 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -523,8 +523,6 @@ void elv_unregister_queue(struct request_queue *q)
 		kobject_del(&e->kobj);
 
 		e->registered = 0;
-		/* Re-enable throttling in case elevator disabled it */
-		wbt_enable_default(q);
 	}
 }
 



[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