Linux block layer
 help / color / mirror / Atom feed
* [PATCH] block: fix rq_qos leak for bio based queue
@ 2022-06-14  6:44 Ming Lei
  2022-06-14  7:12 ` Christoph Hellwig
  0 siblings, 1 reply; 4+ messages in thread
From: Ming Lei @ 2022-06-14  6:44 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei, Yi Zhang

Commit 5ca7546fe317 ("block: move rq_qos_exit() into disk_release()")
moves rq_qos_exit() to disk_release(), but only done for blk-mq queue.

However, now rq qos can be created via blkcg_init_queue() for bio based
queue, so we need to call rq_qos_exit() for bio queue too.

In theory, so far, rq_qos is only implemented for request based queue,
and we should only add it for blk-mq queue. However, if using blk-mq
during allocating queue may not be known, fix the rq qos leak issue by
always releasing rq qos for both two kinds of queues.

Reported-by: Yi Zhang <yi.zhang@redhat.com>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Fixes: 285d5731a0cb ('Revert "block: release rq qos structures for queue without disk"')
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 block/genhd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 556d6e4b38d9..6e7ca8c302aa 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1120,9 +1120,10 @@ static const struct attribute_group *disk_attr_groups[] = {
 	NULL
 };
 
-static void disk_release_mq(struct request_queue *q)
+static void disk_release_queue(struct request_queue *q)
 {
-	blk_mq_cancel_work_sync(q);
+	if (queue_is_mq(q))
+		blk_mq_cancel_work_sync(q);
 
 	/*
 	 * There can't be any non non-passthrough bios in flight here, but
@@ -1166,8 +1167,7 @@ static void disk_release(struct device *dev)
 	might_sleep();
 	WARN_ON_ONCE(disk_live(disk));
 
-	if (queue_is_mq(disk->queue))
-		disk_release_mq(disk->queue);
+	disk_release_queue(disk->queue);
 
 	blkcg_exit_queue(disk->queue);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-14  7:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-14  6:44 [PATCH] block: fix rq_qos leak for bio based queue Ming Lei
2022-06-14  7:12 ` Christoph Hellwig
2022-06-14  7:39   ` Ming Lei
2022-06-14  7:46     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox