[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8gkZzvhnL6+0YQz@slm.duckdns.org>
Date: Wed, 18 Jan 2023 06:55:03 -1000
From: Tejun Heo <tj@...nel.org>
To: Yu Kuai <yukuai1@...weicloud.com>
Cc: hch@....de, josef@...icpanda.com, axboe@...nel.dk,
cgroups@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, yukuai3@...wei.com,
yi.zhang@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH -next v2 2/3] blk-cgroup: support to track if policy is
online
On Wed, Jan 18, 2023 at 08:31:51PM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@...wei.com>
>
> A new field 'online' is added to blkg_policy_date to fix following
^
a
> 2 problem:
>
> 1) In blkcg_activate_policy(), if pd_alloc_fn() with 'GFP_NOWAIT'
> failed, 'queue_lock' will be dropped and pd_alloc_fn() will try again
> without 'GFP_NOWAIT'. In the meantime, remove cgroup can race with
> it, and pd_offline_fn() will be called without pd_init_fn() and
> pd_online_fn(). This way null-ptr-deference can be triggered.
>
> 2) In order to synchronize pd_free_fn() from blkg_free_workfn() and
> blkcg_deactivate_policy(), 'list_del_init(&blkg->q_node)' will be
> delayed to blkg_free_workfn(), hence pd_offline_fn() can be called
> first in blkg_destroy(), and then blkcg_deactivate_policy() will
> call it again, we must prevent it.
>
> The new field 'online' will be set after pd_online_fn() and will be
> cleared after pd_offline_fn(), in the meantime pd_offline_fn() will only
> be called if 'online' is set.
>
> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
Acked-by: Tejun Heo <tj@...nel.org>
Thanks.
--
tejun
Powered by blists - more mailing lists