vzctl restore: support old and new interface of cpt lockfiles

The small historical reference about new semantic of wait_p:

commit fd657abf122caee09189b115f116c9d089695991
Author: Kir Kolyshkin <kir@openvz.org>
Date:   Wed Jan 12 16:14:58 2011 +0300

    That "OK to go" signal is closing a specific file descriptor
    without sending anything via it, while "no go" signal is sending some
    error code. The problem is in case the parent segfaults, the kernel closes
    this fd and so the child thinks that everything is fine and runs init.

    This patch changes the logic: now "no go" signal is just closing fd, while
    "good to go" is actually sending something to that fd.

Now, newer kernels add support of wait_p with new semantic, it can
be set by CPT_SET_LOCK2. Use it if possible.

Nevertheless, backward compatibility with old kernels should be retained.
The above commit fd657abf122 changed sematic of wait_p, but it's sent
to the kernel, which still have old logic (and it broke restore).

This commit also adds back a descriptor with old semantic (old_wait_p),
which is to be used for old kernels (when CPT_SET_LOCK2 is not available).

http://bugzilla.openvz.org/1732

Signed-off-by: Andrey Vagin <avagin@openvz.org>
5 files changed