summaryrefslogtreecommitdiff
path: root/block/genhd.c
diff options
context:
space:
mode:
authorYu Kuai <yukuai3@huawei.com>2022-03-18 16:01:44 +0300
committerJens Axboe <axboe@kernel.dk>2022-03-18 18:57:56 +0300
commit8f9e7b65f833cb9a4b2e2f54a049d74df394d906 (patch)
tree53ea2561819061d557497972434541c212a7c2a2 /block/genhd.c
parent0a9a25ca78437b39e691bcc3dc8240455b803d8d (diff)
downloadlinux-8f9e7b65f833cb9a4b2e2f54a049d74df394d906.tar.xz
block: cancel all throttled bios in del_gendisk()
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@huawei.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20220318130144.1066064-4-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/block/genhd.c b/block/genhd.c
index 56f66c6fee94..8244f09e058d 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -25,6 +25,7 @@
#include <linux/pm_runtime.h>
#include <linux/badblocks.h>
#include <linux/part_stat.h>
+#include "blk-throttle.h"
#include "blk.h"
#include "blk-mq-sched.h"
@@ -627,6 +628,8 @@ void del_gendisk(struct gendisk *disk)
blk_mq_freeze_queue_wait(q);
+ blk_throtl_cancel_bios(disk->queue);
+
blk_sync_queue(q);
blk_flush_integrity();
/*