From: Ming Lei <ming.lei@redhat.com>
To: Yu Kuai <yukuai1@huaweicloud.com>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org, Tejun Heo <tj@kernel.org>,
"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH] block: fix q->blkg_list corruption during disk rebind
Date: Mon, 8 Apr 2024 11:05:21 +0800 [thread overview]
Message-ID: <ZhNe8R8uAO1ehydo@fedora> (raw)
In-Reply-To: <eaa3d105-f37b-3c3b-9e3d-340ae8f5f252@huaweicloud.com>
On Sun, Apr 07, 2024 at 09:40:52PM +0800, Yu Kuai wrote:
> Hi,
>
> 在 2024/04/07 20:59, Ming Lei 写道:
> > Multiple gendisk instances can allocated/added for single request queue
> > in case of disk rebind. blkg may still stay in q->blkg_list when calling
> > blkcg_init_disk() for rebind, then q->blkg_list becomes corrupted.
> >
> > Fix the list corruption issue by:
> >
> > - add blkg_init_queue() to initialize q->blkg_list & q->blkcg_mutex only
> > - move calling blkg_init_queue() into blk_alloc_queue()
> >
> > The list corruption should be started since commit f1c006f1c685 ("blk-cgroup:
> > synchronize pd_free_fn() from blkg_free_workfn() and blkcg_deactivate_policy()")
> > which delays removing blkg from q->blkg_list into blkg_free_workfn().
>
> I'm not familiar with how bind/unbind works yet, however, the patch
> itself looks reasonable to me, the initialization of fields related to
> queue should not be delayed to disk allocation.
>
> Reviewed-by: Yu Kuai <yukuai3@huawei.com>
Thanks!
>
> BTW, it looks like the whole blkcg_init_disk() can go away:
> - init of ioprio and blk-throttle can be delayed to the first user
> configuration;
> - root_blkg allocation doesn't rely on disk at all;
>
> Or is there any plan to move the blkcg related field or code path to
> gendisk instead of queue? I might missing some previous discussions.
Christoph worked towards this direction, but not succeed:
a06377c5d01e Revert "blk-cgroup: pin the gendisk in struct blkcg_gq"
9a9c261e6b55 Revert "blk-cgroup: pass a gendisk to blkg_lookup"
1231039db31c Revert "blk-cgroup: move the cgroup information to struct gendisk"
dcb522014351 Revert "blk-cgroup: simplify blkg freeing from initialization failure paths"
Thanks,
Ming
next prev parent reply other threads:[~2024-04-08 3:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-07 12:59 [PATCH] block: fix q->blkg_list corruption during disk rebind Ming Lei
2024-04-07 13:40 ` Yu Kuai
2024-04-08 3:05 ` Ming Lei [this message]
2024-04-07 21:50 ` Jens Axboe
2024-04-08 5:58 ` Christoph Hellwig
2024-04-08 7:42 ` Ming Lei
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=ZhNe8R8uAO1ehydo@fedora \
--to=ming.lei@redhat.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=tj@kernel.org \
--cc=yukuai1@huaweicloud.com \
--cc=yukuai3@huawei.com \
/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.