OpenVZ Forum


Home » Mailing lists » Devel » Re: [PATCH 3/7] Containers (V8): Add generic multi-subsystem API to containers
Re: [PATCH 3/7] Containers (V8): Add generic multi-subsystem API to containers [message #11809] Sat, 07 April 2007 04:11 Go to next message
Srivatsa Vaddagiri is currently offline  Srivatsa Vaddagiri
Messages: 241
Registered: August 2006
Senior Member
On Fri, Apr 06, 2007 at 04:32:24PM -0700, menage@google.com wrote:
> +static int attach_task(struct container *cont, struct task_struct *tsk)
> {

[snip]

> + task_lock(tsk);

You need to check here if task state is PF_EXITING and fail with
-ESRCH if so? Otherwise we risk breaking refcount on
init_container_group.

> + rcu_assign_pointer(tsk->containers, newcg);
> + task_unlock(tsk);

--
Regards,
vatsa
Re: [PATCH 3/7] Containers (V8): Add generic multi-subsystem API to containers [message #11817 is a reply to message #11809] Sat, 07 April 2007 17:30 Go to previous message
Paul Menage is currently offline  Paul Menage
Messages: 642
Registered: September 2006
Senior Member
On 4/6/07, Srivatsa Vaddagiri <vatsa@in.ibm.com> wrote:
> On Fri, Apr 06, 2007 at 04:32:24PM -0700, menage@google.com wrote:
> > +static int attach_task(struct container *cont, struct task_struct *tsk)
> > {
>
> [snip]
>
> > + task_lock(tsk);
>
> You need to check here if task state is PF_EXITING and fail with
> -ESRCH if so? Otherwise we risk breaking refcount on
> init_container_group.
>

Yes, I think you're right; I've now changed it to this in my tree:

task_lock(tsk);
if (tsk->flags & PF_EXITING) {
task_unlock(tsk);
put_container_group(newcg);
return -ESRCH;
}
rcu_assign_pointer(tsk->containers, newcg);
task_unlock(tsk);

Thanks,

Paul
Previous Topic: i/o accounting in 2.6.18 openvz :: show_io_stats
Next Topic: Re: [PATCH] net: Add etun driver
Goto Forum:
  


Current Time: Fri Jul 12 11:27:41 GMT 2024

Total time taken to generate the page: 0.02265 seconds