* nsgroup autoremoving
@ 2009-01-16 10:23 Daniel Lezcano
[not found] ` <49706006.80002-GANU6spQydw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lezcano @ 2009-01-16 10:23 UTC (permalink / raw)
To: Linux Containers,
linux- >> Meiosys Linux Development Interlock
Hi,
While trying to unshare a namespace with the clone syscall with an
inifinite loop, I got an EEXIST.
That looks weird to have such syscall returning EEXIST ... :)
After investigating, it appears the ns_cgroup creates automatically a
control group named with the pid number when we call the clone syscall
with a namespace parameter and when the namespace exits, the control
group is not automatically removed. So when the pid numbers are recycled
we conflict with a previous ns_cgroup name and the clone fails.
IMHO, if the nsgroup is automatically created, it should automatically
destroyed, otherwise what will happen to application using the
namespaces (eg. mount namespace) wrote before nsgroup appeared ?
Thanks.
-- Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nsgroup autoremoving
[not found] ` <49706006.80002-GANU6spQydw@public.gmane.org>
@ 2009-01-16 16:52 ` Serge E. Hallyn
[not found] ` <20090116165217.GA8477-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Serge E. Hallyn @ 2009-01-16 16:52 UTC (permalink / raw)
To: Daniel Lezcano; +Cc: Linux Containers
Quoting Daniel Lezcano (daniel.lezcano-GANU6spQydw@public.gmane.org):
> Hi,
>
> While trying to unshare a namespace with the clone syscall with an
> inifinite loop, I got an EEXIST.
> That looks weird to have such syscall returning EEXIST ... :)
>
> After investigating, it appears the ns_cgroup creates automatically a
> control group named with the pid number when we call the clone syscall
> with a namespace parameter and when the namespace exits, the control
> group is not automatically removed. So when the pid numbers are recycled
> we conflict with a previous ns_cgroup name and the clone fails.
>
> IMHO, if the nsgroup is automatically created, it should automatically
> destroyed, otherwise what will happen to application using the
> namespaces (eg. mount namespace) wrote before nsgroup appeared ?
but you can have it automatically destroyed. I.e. I did the
following:
mount -t cgroup -o freezer,ns freezer /cgroup
cat > /bin/release_cgroup.sh << EOF
#!/bin/sh
echo "Removing dead cgroup .$*." >> /var/log/cgroup
rmdir /cgroup/$* >> /var/log/cgroup 2>&1
echo "return value was $?" >> /var/log/cgroup
EOF
echo /bin/release_cgroup.sh > /cgroup/release_agent
echo 1 > /cgroup/notify_on_release
chmod ugo+x /bin/release_cgroup.sh
ns_exec -m /bin/sh
ls /cgroup`
3581 notify_on_release release_agent tasks
exit
ls /cgroup
notify_on_release release_agent tasks
-serge
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nsgroup autoremoving
[not found] ` <20090116165217.GA8477-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-01-18 21:35 ` Daniel Lezcano
[not found] ` <4973A0AD.6090508-GANU6spQydw@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Lezcano @ 2009-01-18 21:35 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers
Serge E. Hallyn wrote:
> Quoting Daniel Lezcano (daniel.lezcano-GANU6spQydw@public.gmane.org):
>
>> Hi,
>>
>> While trying to unshare a namespace with the clone syscall with an
>> inifinite loop, I got an EEXIST.
>> That looks weird to have such syscall returning EEXIST ... :)
>>
>> After investigating, it appears the ns_cgroup creates automatically a
>> control group named with the pid number when we call the clone syscall
>> with a namespace parameter and when the namespace exits, the control
>> group is not automatically removed. So when the pid numbers are recycled
>> we conflict with a previous ns_cgroup name and the clone fails.
>>
>> IMHO, if the nsgroup is automatically created, it should automatically
>> destroyed, otherwise what will happen to application using the
>> namespaces (eg. mount namespace) wrote before nsgroup appeared ?
>>
>
> but you can have it automatically destroyed. I.e. I did the
> following:
>
> mount -t cgroup -o freezer,ns freezer /cgroup
> cat > /bin/release_cgroup.sh << EOF
> #!/bin/sh
> echo "Removing dead cgroup .$*." >> /var/log/cgroup
> rmdir /cgroup/$* >> /var/log/cgroup 2>&1
> echo "return value was $?" >> /var/log/cgroup
> EOF
> echo /bin/release_cgroup.sh > /cgroup/release_agent
> echo 1 > /cgroup/notify_on_release
> chmod ugo+x /bin/release_cgroup.sh
> ns_exec -m /bin/sh
> ls /cgroup`
> 3581 notify_on_release release_agent tasks
> exit
> ls /cgroup
> notify_on_release release_agent tasks
>
Assuming you mount with all the subsystems, this script will destroy the
non-nsgroup too. Each time I create a control group manually, I have to
unset the notify_on_release, right ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nsgroup autoremoving
[not found] ` <4973A0AD.6090508-GANU6spQydw@public.gmane.org>
@ 2009-01-18 23:32 ` Serge E. Hallyn
[not found] ` <20090118233216.GA10126-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Serge E. Hallyn @ 2009-01-18 23:32 UTC (permalink / raw)
To: Daniel Lezcano; +Cc: Linux Containers, Paul Menage
Quoting Daniel Lezcano (daniel.lezcano-GANU6spQydw@public.gmane.org):
> Serge E. Hallyn wrote:
>> Quoting Daniel Lezcano (daniel.lezcano-GANU6spQydw@public.gmane.org):
>>
>>> Hi,
>>>
>>> While trying to unshare a namespace with the clone syscall with an
>>> inifinite loop, I got an EEXIST.
>>> That looks weird to have such syscall returning EEXIST ... :)
>>>
>>> After investigating, it appears the ns_cgroup creates automatically a
>>> control group named with the pid number when we call the clone
>>> syscall with a namespace parameter and when the namespace exits, the
>>> control group is not automatically removed. So when the pid numbers
>>> are recycled we conflict with a previous ns_cgroup name and the clone
>>> fails.
>>>
>>> IMHO, if the nsgroup is automatically created, it should
>>> automatically destroyed, otherwise what will happen to application
>>> using the namespaces (eg. mount namespace) wrote before nsgroup
>>> appeared ?
>>>
>>
>> but you can have it automatically destroyed. I.e. I did the
>> following:
>>
>> mount -t cgroup -o freezer,ns freezer /cgroup
>> cat > /bin/release_cgroup.sh << EOF
>> #!/bin/sh
>> echo "Removing dead cgroup .$*." >> /var/log/cgroup
>> rmdir /cgroup/$* >> /var/log/cgroup 2>&1
>> echo "return value was $?" >> /var/log/cgroup
>> EOF
>> echo /bin/release_cgroup.sh > /cgroup/release_agent
>> echo 1 > /cgroup/notify_on_release
>> chmod ugo+x /bin/release_cgroup.sh
>> ns_exec -m /bin/sh
>> ls /cgroup`
>> 3581 notify_on_release release_agent tasks
>> exit
>> ls /cgroup
>> notify_on_release release_agent tasks
>>
> Assuming you mount with all the subsystems, this script will destroy the
> non-nsgroup too. Each time I create a control group manually, I have to
> unset the notify_on_release, right ?
I assume notify_on_release is per-hierarchy. So you're just asking
about manually created cgroups in a hierarchy which has ns mounted,
right?
I suppose you could use a naming convention and do some name
checking in the release_agent to not delete manually created
ones.
Would that be too much of a hassle?
Maybe you're right. Maybe we should tag auto-created cgroups,
and auto-remove them. It's more convenient for me that way...
Paul, would you have any objections? Daniel do you have a patch
written?
-serge
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nsgroup autoremoving
[not found] ` <20090118233216.GA10126-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-01-19 3:05 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2009-01-19 3:05 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: Linux Containers, Paul Menage
On Sun, 18 Jan 2009 17:32:16 -0600
"Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org> wrote:
> Quoting Daniel Lezcano (daniel.lezcano-GANU6spQydw@public.gmane.org):
> > Serge E. Hallyn wrote:
> >> Quoting Daniel Lezcano (daniel.lezcano-GANU6spQydw@public.gmane.org):
> >>
> >>> Hi,
> >>>
> >>> While trying to unshare a namespace with the clone syscall with an
> >>> inifinite loop, I got an EEXIST.
> >>> That looks weird to have such syscall returning EEXIST ... :)
> >>>
> >>> After investigating, it appears the ns_cgroup creates automatically a
> >>> control group named with the pid number when we call the clone
> >>> syscall with a namespace parameter and when the namespace exits, the
> >>> control group is not automatically removed. So when the pid numbers
> >>> are recycled we conflict with a previous ns_cgroup name and the clone
> >>> fails.
> >>>
> >>> IMHO, if the nsgroup is automatically created, it should
> >>> automatically destroyed, otherwise what will happen to application
> >>> using the namespaces (eg. mount namespace) wrote before nsgroup
> >>> appeared ?
> >>>
> >>
> >> but you can have it automatically destroyed. I.e. I did the
> >> following:
> >>
> >> mount -t cgroup -o freezer,ns freezer /cgroup
> >> cat > /bin/release_cgroup.sh << EOF
> >> #!/bin/sh
> >> echo "Removing dead cgroup .$*." >> /var/log/cgroup
> >> rmdir /cgroup/$* >> /var/log/cgroup 2>&1
> >> echo "return value was $?" >> /var/log/cgroup
> >> EOF
> >> echo /bin/release_cgroup.sh > /cgroup/release_agent
> >> echo 1 > /cgroup/notify_on_release
> >> chmod ugo+x /bin/release_cgroup.sh
> >> ns_exec -m /bin/sh
> >> ls /cgroup`
> >> 3581 notify_on_release release_agent tasks
> >> exit
> >> ls /cgroup
> >> notify_on_release release_agent tasks
> >>
> > Assuming you mount with all the subsystems, this script will destroy the
> > non-nsgroup too. Each time I create a control group manually, I have to
> > unset the notify_on_release, right ?
>
> I assume notify_on_release is per-hierarchy. So you're just asking
> about manually created cgroups in a hierarchy which has ns mounted,
> right?
>
> I suppose you could use a naming convention and do some name
> checking in the release_agent to not delete manually created
> ones.
>
> Would that be too much of a hassle?
>
> Maybe you're right. Maybe we should tag auto-created cgroups,
> and auto-remove them.
I think auto-remove is more useful.
> It's more convenient for me that way...
> Paul, would you have any objections? Daniel do you have a patch
> written?
>
Just a notice:
When the memory subsystem is mounted, notify_on_release will not work as you
expected. Because refcnts from pages still exits.
But you will be able to do rmdir() in many case because of pre_destroy()
handler. (so, the directroy is releasable.)
I'd like to fix this. But now, it doesn't work for memory subsys.
Thanks,
-Kame
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-01-19 3:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-16 10:23 nsgroup autoremoving Daniel Lezcano
[not found] ` <49706006.80002-GANU6spQydw@public.gmane.org>
2009-01-16 16:52 ` Serge E. Hallyn
[not found] ` <20090116165217.GA8477-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-01-18 21:35 ` Daniel Lezcano
[not found] ` <4973A0AD.6090508-GANU6spQydw@public.gmane.org>
2009-01-18 23:32 ` Serge E. Hallyn
[not found] ` <20090118233216.GA10126-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-01-19 3:05 ` KAMEZAWA Hiroyuki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.