Re: [PATCH] sched: fix another race when reading /proc/sched_debug

From: Li Zefan
Date: Tue Dec 16 2008 - 07:56:54 EST


Paul Menage wrote:
> On Tue, Dec 16, 2008 at 1:41 AM, Paul Menage <menage@xxxxxxxxxx> wrote:
>> It should be OK to rcu-free cgrp and have it still safe to call
>> cgroup_path() on it - as long as we're confident that the dentry (and
>> all its parents) won't be released until after the RCU section as
>> well, since that's where we get the path elements from. And that does
>> seem to be the case from looking at dcache.c
>>
>> It's certainly nicer than having two calls to synchronize_rcu() in
>> quick succession in cgroup_diput().
>
> How about something like this?
>

This solves half of the problem..

This avoids accessing a destroyed cgroup, but still race with cgroup_create.
You sugguested call cgroup_create_dir() before calling subsystems' create()
method.

> Paul
>
> include/linux/cgroup.h | 9 +++++++++
> kernel/cgroup.c | 49 ++++++++++++++++++++++++++++---------------------
> 2 files changed, 37 insertions(+), 21 deletions(-)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/