From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org, ming.lei@redhat.com
Subject: Re: [PATCH] blk-cgroup: delay calling blkcg_exit_disk until disk_release
Date: Mon, 13 Feb 2023 16:37:09 +0800 [thread overview]
Message-ID: <Y+n2tX4fVuRrQLuN@T590> (raw)
In-Reply-To: <Y+XQh3zMHMIX2+jr@T590>
On Fri, Feb 10, 2023 at 01:05:11PM +0800, Ming Lei wrote:
> On Wed, Feb 08, 2023 at 07:35:14AM +0100, Christoph Hellwig wrote:
> > While del_gendisk ensures there is no outstanding I/O on the queue,
> > it can't prevent block layer users from building new I/O.
> >
> > This leads to a NULL ->root_blkg reference in bio_associate_blkg when
> > allocating a new bio on a shut down file system. Delay freeing the
> > blk-cgroup subsystems from del_gendisk until disk_release to make
> > sure the blkg and throttle information is still avaіlable for bio
> > submitters, even if those bios will immediately fail.
> >
> > This now can cause a case where disk_release is called on a disk
> > that hasn't been added. That's mostly harmless, except for a case
> > in blk_throttl_exit that now needs to check for a NULL ->td pointer.
> >
> > Fixes: 178fa7d49815 ("blk-cgroup: delay blk-cgroup initialization until add_disk")
> > Reported-by: Ming Lei <ming.lei@redhat.com>
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> hammmmmm, this patch actually causes bigger trouble.
>
> After commit 84d7d462b16d ("blk-cgroup: pin the gendisk in struct blkcg_gq"),
> blkcg_gq instance grabs disk's reference, so moving blkcg_exit_disk
> into disk_release() just causes reference cross-dependency, both are
> leaked.
Hi Christoph & Jens,
This issue is a bit serious, both blkg & disk & request_queue are leaked by
commit c43332fe028c ("blk-cgroup: delay calling blkcg_exit_disk until disk_release").
Can we solve it before merging for-6.3/block into v6.3-rc1?
Thanks,
Ming
next prev parent reply other threads:[~2023-02-13 8:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 6:35 [PATCH] blk-cgroup: delay calling blkcg_exit_disk until disk_release Christoph Hellwig
2023-02-08 7:38 ` Ming Lei
2023-02-08 15:12 ` Christoph Hellwig
2023-02-08 23:47 ` Ming Lei
2023-02-09 5:04 ` Christoph Hellwig
2023-02-09 8:56 ` Ming Lei
2023-02-09 15:12 ` Jens Axboe
2023-02-10 5:05 ` Ming Lei
2023-02-13 8:37 ` Ming Lei [this message]
2023-02-13 8:42 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y+n2tX4fVuRrQLuN@T590 \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.