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

Glauber Costa glommer at parallels.com
Thu May 16 12:25:57 EDT 2013


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.



More information about the CRIU mailing list