diff mbox series

[4/4] block: cancel all throttled bios in blk_cleanup_queue()

Message ID 20210922125115.381752-5-yukuai3@huawei.com (mailing list archive)
State New, archived
Headers show
Series cancel all throttled bios in blk_cleanup_queue() | expand

Commit Message

Yu Kuai Sept. 22, 2021, 12:51 p.m. UTC
Throttled bios can't be issued after queue is dying in
blk_cleanup_queue(), thus it's better to cancel them immediately
rather than waiting for throttle is done.

For example, if user thread is throttled with low bps while is
issuing large io, and the device is deleted. The user thread will
wait for a long time for io to return.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/blk-core.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Christoph Hellwig Sept. 22, 2021, 2:34 p.m. UTC | #1
On Wed, Sep 22, 2021 at 08:51:15PM +0800, Yu Kuai wrote:
> Throttled bios can't be issued after queue is dying in
> blk_cleanup_queue(), thus it's better to cancel them immediately
> rather than waiting for throttle is done.
> 
> For example, if user thread is throttled with low bps while is
> issuing large io, and the device is deleted. The user thread will
> wait for a long time for io to return.

blk_cleanup_queue is too late, this will need to go into del_gendisk
and on top of my "tear down file system I/O in del_gendisk" series.
Yu Kuai Sept. 23, 2021, 1:31 p.m. UTC | #2
On 2021/09/22 22:34, Christoph Hellwig wrote:
> On Wed, Sep 22, 2021 at 08:51:15PM +0800, Yu Kuai wrote:
>> Throttled bios can't be issued after queue is dying in
>> blk_cleanup_queue(), thus it's better to cancel them immediately
>> rather than waiting for throttle is done.
>>
>> For example, if user thread is throttled with low bps while is
>> issuing large io, and the device is deleted. The user thread will
>> wait for a long time for io to return.
> 
> blk_cleanup_queue is too late, this will need to go into del_gendisk
> and on top of my "tear down file system I/O in del_gendisk" series.
> .
> 

Hi,

I see what your series is trying to do, it semms not easy to
collaborate. I'll wait for your series to applied if you don't mind,
or you can take over this series.

Thanks,
Kuai
diff mbox series

Patch

diff --git a/block/blk-core.c b/block/blk-core.c
index 5454db2fa263..356a56318068 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -389,6 +389,9 @@  void blk_cleanup_queue(struct request_queue *q)
 
 	blk_queue_flag_set(QUEUE_FLAG_DEAD, q);
 
+	if (q->root_blkg)
+		blk_throtl_cancel_bios(q);
+
 	/* for synchronous bio-based driver finish in-flight integrity i/o */
 	blk_flush_integrity();