mount: Don't validate mounts read from proc on restore

Validation means -- check chat we can _restore_ this tree.
Those read from proc can be in any state -- we're going to
umount them (can do anything) and do path resolution (work
for any knots as well).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Free old mounts for pivot-root case

If we specify a new root for restore old mounts get destroyed
with pivot_root + umount calls, tree umount is omitted. In this
case mi-s are leaked.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: Factor out mount tree build for NEWNS and non-NS cases

We anyway build the tree, in the NS case -- few calls later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm: Allow to specify more than one exclude pattern

We sometimes want to exclude several tests from run. Writing
expression with \-s is annoying. Let's make it possible to
do several -x's instead.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
files: Don't lose anon-file type name

The symlink reader reports the amount of bytes read
in case of success.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr_service(): close fd on error

... and don't return -1.

This is a missing part from commit 3477223.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
cr_service(): don't exit(-1)

We should exit(1) on error, exit(0) on success.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu: don't return negative values from main() 1/2

We should return 1 not -1, because -1 becomes 255.

>From man bash: "the shell may use values above
125 specially". Don't be a black sheep and return 1.

This is first part, patching obvious direct return statements.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu: don't return negative values from main() 2/2

We should return 1 not -1, because -1 becomes 255.

This is second part, patching return from functions.
Using 'ret != 0' condition seems like the best and easiest
thing to do, so we expect a function to return 0 in normal
case and any non-zero value in case of error.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu --help: limit output to 80 columns

...by rephrasing the --work-dir option description.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu --help: rephrase --pidfile description

... to fit in a single line.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu --help: add missing colon

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu --help: improve --work-dir description

There should either be a comma before the second line, or it should be
in parenthesis. I chose latter.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
pr_perror(): don't end message with a period

When pr_perror is used, an error message is appended with a comma
and an strerror(errno), so we should not put a period at the end,
otherwise we'll end up with something like this:

	Error: Can't bind.: Permission denied

Found by git grep -w pr_perror | grep '\."'

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu check: don't run as non-root

In case criu check is run as non-root, a lot of information is printed
to a user, with the only missing bit is it should run it as root.

Fix it.

I still don't like the fact that some other stuff is printed here,
like the timestamp and the __FILE__:__LINE__, but this should be
fixed separately.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
crtools: Keep cr_dump_task's post-dump ret code

Broken by 09b7b57c.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: pie -- Explicitly cleanup specific targets

make engine will be reworked to clean up only those
files which were generated with implicit rules. Thus
anything generated in specific way must be cleaned
up explicitly.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: protobuf -- Explicitly clean generated files

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
make: Makefile.build -- Improve autocleanup target

Currently we clean up with wildchar mask. This actually
not that correct. Lets remove only the files were generated
by our make engine.

This as well allows to clean up objects generated as $obj-e
target even if the directory $obj-e is laying in doesn't have
own Makefile.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-read: add proper processing of return value

when get an error reading image file need stop restore

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>