All of lore.kernel.org
 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

* Re: [PATCH] block: fix rq_qos leak for bio based queue
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2022-06-14  7:12 UTC (permalink / raw)
  To: Ming Lei; +Cc: Jens Axboe, linux-block, Yi Zhang

On Tue, Jun 14, 2022 at 02:44:26PM +0800, Ming Lei wrote:
> 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.

This is also fixed by "block: disable the elevator int del_gendisk"
which was just resent yesterday, and fundamentally gets the lifetimes
right rather than doctoring around even more.

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

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

On Tue, Jun 14, 2022 at 12:12:03AM -0700, Christoph Hellwig wrote:
> On Tue, Jun 14, 2022 at 02:44:26PM +0800, Ming Lei wrote:
> > 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.
> 
> This is also fixed by "block: disable the elevator int del_gendisk"
> which was just resent yesterday, and fundamentally gets the lifetimes
> right rather than doctoring around even more.
 
Just checked my block mbox and lore, not see the patch sent from
yesterday.

Thanks, 
Ming


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

* Re: [PATCH] block: fix rq_qos leak for bio based queue
  2022-06-14  7:39   ` Ming Lei
@ 2022-06-14  7:46     ` Christoph Hellwig
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2022-06-14  7:46 UTC (permalink / raw)
  To: Ming Lei; +Cc: Christoph Hellwig, Jens Axboe, linux-block, Yi Zhang

On Tue, Jun 14, 2022 at 03:39:22PM +0800, Ming Lei wrote:
> Just checked my block mbox and lore, not see the patch sent from
> yesterday.

Hmm, weird.  vger had some odd hickups the last last days, but you
also were Cced personally.  I'll resend it.

^ permalink raw reply	[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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.