Re: [PATCH -mm] cgroups: fix failure path in cgroup_write_event_control()

From: Kirill A. Shutemov
Date: Wed Feb 24 2010 - 08:28:37 EST


On Wed, Feb 24, 2010 at 5:22 AM, Li Zefan <lizf@xxxxxxxxxxxxxx> wrote:
> How to reproduce:
>
> Â# mount -t cgroup -o memory xxx /cgroup
> Â# mkdir /cgroup/tmp
> Â# ./cgroup_event_listener /cgroup/tmp/cgroup.event_control abc
> Â^C
> Â# rmdir /cgroup/tmp
> Â# cat /proc/cgroups | grep memory
> Âmemory Â2 Â Â Â 2 Â Â Â 1 Â Â Â Â (should be "2 1 1")
> Â# umount /cgroup
> Â(failed!)
>
> Using a single goto label to cleanup multi failure paths can
> get things wrong quite easily, while multi labels makes the
> code cleaner.

I disagree.
It's easer to make mistake on changing code with multi failure
paths, if you want to move a code within function.
--
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/