[Devel] [PATCH 2/6] vzctl: save PID of init in a state file

Andrew Vagin avagin at parallels.com
Fri May 17 01:16:14 PDT 2013


On Thu, May 16, 2013 at 08:25:57PM +0400, Glauber Costa wrote:
> On 05/16/2013 04:14 PM, Andrey Vagin wrote:
> > CRIU requires a pid of the init.
> > 
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> 
> The way you coded it, it seems to me that we will always overwrite the
> pid file, which is fine: this way we won't run into the usual "pid file
> already exists" kinds of problem. When we reach this point, we already
> tested if the container is running... My only fear is that we do that by
> verifying if there is any tasks already in the cgroup. So can we race
> against other container creation?
> 
> We put ourselves in the container before we call clone, so *at this
> point* the vps_is_run test would fail, but by now we have already tested
> it a while ago... Maybe vzctl has other mechanism against such races
> that I am not aware of, but could you explain me why we don't have this
> race? It is my only concern, the rest looks fine. Having the init pid is
> quite handy for other situations as well, like stop --fast.
> So far we hack that by killing everybody until no more tasks are found
> in the cgroup, but what I always wanted was really a mechanism to kill init.
> 

We had a discusion with Glauber. The summary is that this patch doesn't
create new race conditions, but we can use locks on a state file to fix
the existent race condition.



More information about the Devel mailing list