[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181127205427.v2x7ezd6jgkxg562@macbook-pro-91.dhcp.thefacebook.com>
Date: Tue, 27 Nov 2018 15:54:29 -0500
From: Josef Bacik <josef@...icpanda.com>
To: Dennis Zhou <dennis@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>, Tejun Heo <tj@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
Josef Bacik <josef@...icpanda.com>, kernel-team@...com,
linux-block@...r.kernel.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/13] blkcg: fix ref count issue with bio_blkcg() using
task_css
On Mon, Nov 26, 2018 at 04:19:34PM -0500, Dennis Zhou wrote:
> The bio_blkcg() function turns out to be inconsistent and consequently
> dangerous to use. The first part returns a blkcg where a reference is
> owned by the bio meaning it does not need to be rcu protected. However,
> the third case, the last line, is problematic:
>
> return css_to_blkcg(task_css(current, io_cgrp_id));
>
> This can race against task migration and the cgroup dying. It is also
> semantically different as it must be called rcu protected and is
> susceptible to failure when trying to get a reference to it.
>
> This patch adds association ahead of calling bio_blkcg() rather than
> after. This makes association a required and explicit step along the
> code paths for calling bio_blkcg(). In blk-iolatency, association is
> moved above the bio_blkcg() call to ensure it will not return %NULL.
>
> BFQ uses the old bio_blkcg() function, but I do not want to address it
> in this series due to the complexity. I have created a private version
> documenting the inconsistency and noting not to use it.
>
> Signed-off-by: Dennis Zhou <dennis@...nel.org>
> Acked-by: Tejun Heo <tj@...nel.org>
Reviewed-by: Josef Bacik <josef@...icpanda.com>
Thanks,
Josef
Powered by blists - more mailing lists