[PATCH 4/4] block: cancel all throttled bios in del_gendisk()
From: Yu Kuai
Date: Sat Nov 27 2021 - 05:01:05 EST
Throttled bios can't be issued after del_gendisk() is done, 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 it's
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@xxxxxxxxxx>
---
block/genhd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/genhd.c b/block/genhd.c
index 8e9cbf23c510..24fa3356d164 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -28,6 +28,7 @@
#include "blk.h"
#include "blk-rq-qos.h"
+#include "blk-throttle.h"
static struct kobject *block_depr;
@@ -619,6 +620,7 @@ void del_gendisk(struct gendisk *disk)
blk_mq_freeze_queue_wait(q);
+ blk_throtl_cancel_bios(q);
rq_qos_exit(q);
blk_sync_queue(q);
blk_flush_integrity();
--
2.31.1