All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Daniel Lezcano <daniel.lezcano-GANU6spQydw@public.gmane.org>
Cc: Linux Containers <containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>
Subject: Re: nsgroup autoremoving
Date: Fri, 16 Jan 2009 10:52:17 -0600	[thread overview]
Message-ID: <20090116165217.GA8477@us.ibm.com> (raw)
In-Reply-To: <49706006.80002-GANU6spQydw@public.gmane.org>

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

  parent reply	other threads:[~2009-01-16 16:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090116165217.GA8477@us.ibm.com \
    --to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=daniel.lezcano-GANU6spQydw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.