Messages in this thread | | | Date | Tue, 9 Sep 2008 22:01:12 -0700 | From | Greg KH <> | Subject | Re: [PATCH] cgroups: fix probable race with put_css_set[_taskexit] and find_css_set |
| |
On Wed, Sep 10, 2008 at 10:18:36AM +0800, Lai Jiangshan wrote: > Paul Menage wrote: > > On Mon, Aug 18, 2008 at 11:29 PM, Lai Jiangshan <laijs@cn.fujitsu.com> wrote: > > > > 2) Use atomic_inc_not_zero() in find_existing_css_set(), to ensure > > that we only return a referenced css, and remove the get_css_set() > > call from find_css_set(). (Possibly wrapping this in a new > > kref_get_not_zero() function) > > > > [CC: Greg Kroah-Hartman <greg@kroah.com>] > > There are indeed several ways fix this race by Using the > atomic-functions directly. I prefer the second one, i makes all > code clearly. And put_css_set[_taskexit] do not need to be changed. > > I don't think adding kref_get_not_zero() API is a good idea. > It will bring kref APIs to a little chaos, kref_get_not_zero() is > hard to be used, for this function needs a special lock held. > > But I tried:
What are you trying to solve here with this change? I agree, it does seem a bit "chaotic" :)
I thought we used to have something like this for kref in the past, but I must be mistaken as it's no longer there...
thanks,
greg k-h
| |