Re: [PATCH] Make cgroup_path() RCU-safe

From: Li Zefan
Date: Tue Dec 16 2008 - 20:18:18 EST


Paul Menage wrote:
> Make cgroup_path() RCU safe
>
> This patch fixes races between /proc/sched_debug by freeing
> cgroup objects via an RCU callback. Thus any cgroup reference obtained
> from an RCU-safe source will remain valid during the RCU section. Since
> dentries are also RCU-safe, this allows us to traverse up the tree safely.
>
> Additionally, make cgroup_path() check for a NULL cgrp->dentry to avoid
> trying to report a path for a partially-created cgroup.
>
> Signed-off-by: Paul Menage <menage@xxxxxxxxxx>
>

Thanks!

Reviewed-by: Li Zefan <lizf@xxxxxxxxxxxxxx>
Tested-by: Li Zefan <lizf@xxxxxxxxxxxxxx>

But the patch is word wrapped..

> --
>
> There are more RCU changes that I can make for 2.6.29+, but this
> should fix the problem in 2.6.28

...

> +/*
> + * cgroup_path() fills in a filesystem-like path for the given cgroup
> + * into "buf", up to "buflen" characters. Should be called with
> + * cgroup_mutex held, or else in an RCU section with an RCU-protected
> + * cgroup reference
> + */

minor comment:

We already have kernel-doc for cgroup_path(), why do we need those comments
in cgroup.h.

> int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen);
>
--
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/