[Devel] Re: [RFC][PATCH] Make access to taks's nsproxy liter
Oleg Nesterov
oleg at tv-sign.ru
Wed Aug 8 09:58:17 PDT 2007
On 08/08, Serge E. Hallyn wrote:
>
> Quoting Pavel Emelyanov (xemul at openvz.org):
> > +void switch_task_namespaces(struct task_struct *p, struct nsproxy *new)
> > +{
> > + struct nsproxy *ns;
> > +
> > + might_sleep();
> > +
> > + ns = p->nsproxy;
> > + if (ns == new)
> > + return;
> > +
> > + if (new)
> > + get_nsproxy(new);
> > + rcu_assign_pointer(p->nsproxy, new);
> > +
> > + if (ns && atomic_dec_and_test(&ns->count)) {
> > + /*
> > + * wait for others to get what they want from this
> > + * nsproxy. cannot release this nsproxy via the
> > + * call_rcu() since put_mnt_ns will want to sleep
> > + */
> > + synchronize_rcu();
> > + free_nsproxy(ns);
> > + }
> > +}
>
> Also a comment above switch_task_namespaces() that it must be called
> with task_lock held.
Heh, indeed, sys_unshare() does this. might_sleep() won't be happy.
Oleg.
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list