All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org
Subject: Re: [PATCH] blk-cgroup: delay calling blkcg_exit_disk until disk_release
Date: Thu, 9 Feb 2023 07:47:38 +0800	[thread overview]
Message-ID: <Y+Q0mp1cV3Ca6bAf@T590> (raw)
In-Reply-To: <20230208151231.GA16018@lst.de>

On Wed, Feb 08, 2023 at 04:12:31PM +0100, Christoph Hellwig wrote:
> On Wed, Feb 08, 2023 at 03:38:40PM +0800, Ming Lei wrote:
> > > 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.
> > 
> > With this way, blkcg_init_disk() could be called before q->root_blkg
> > is released in disk unbind & rebind use case, then memory leak?
> 
> q->root_blkg is now disk->root_blkg.  So in an unind and rebind case
> a different disk will be involved.

OK.

Another thing is that blkcg_init_disk() and blkcg_exit_disk() becomes
asymmetrical with this patch. So alloc_disk() & add_disk(), del_disk() & put_disk()
have to be done together. If it may be documented, this patch looks
fine.


Thanks, 
Ming


  reply	other threads:[~2023-02-08 23:48 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 [this message]
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
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+Q0mp1cV3Ca6bAf@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.