headers: Add fs-magic.h

Not all distros provide magic numbers we might need
during build procedure, thus provide own definitions
in one known place.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
headers: Use fs-magic.h

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm/lock: make futex_inc and futex_dec atomical

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm/maps007: limit delta betwen parent and child from both sides

Currenty a parent can go far away from child and we will need to wait
too long for checking results.

This pach limits delta to [MIN_DELTA, 2 * MIN_DELTA].

Thi patch should fix current errors for the CRIU-iter job in Jenkins.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm/lock: add futex_add_and_wake and futex_wait_while_lt

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
zdtm/maps007: remove spinlocks from the test

Use futex for synchronization instead of spinning on atomic variables.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
mount: rename TMPFS_MAGIC into TMPFS_IMG_MAGIC

TMPFS_MAGIC is already used in linux/magic.h

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
fsnotify: dump tmpfs notify watchers by names (v2)

Currently file handles are used for dumping {i,fs}notify watchers.

But inode numbers are not restored for tmpfs content, so watchers can't
be opened by handles.

Pavel found, that tmpfs cache is not pruned, so a handle can be opened,
and readlink(/proc/PID/fd/X) will return a corect path to the file.

v2: use read_fd_link()
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
maps007: save core files in a error case

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
test: add scripts, which are used by jenkins (v2)

v2: split one job on a few parts
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
log: Add pr_warn_once helper

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
x86: Allow forward compatibility mode for FPU

At the moment we refuse to restore if CPU mismatch
at FPU related features. Strictly speaking this is
not required.

We can allow to restore on the node with xsave capability
even if the node was created on cpu which has fxsave
capability only.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
criu: Add --cpu-cap option

This option will serve to manage CPU capabilities
to be matched/ignored on restore procedure. At the
moment we introduce 'fpu','all' capability arguments.
By default 'all' is set.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
x86: restore -- Allow to restore fpu even if image is incomatible with cpu state

Sometime, especially when testing, we migrate checkpointed tasks between
nodes which have different CPU capabilities. In particular some CPUs have
xsave feature while others -- do not. So to be able to continue migration
procedure even in such conditions one should specify

	--cpu-cap ^fpu

on command line which would force criu to restore FPU state ignoring extended
status present in image file.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
v2 deduplication: add separate function for punch to use on restore

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
v2 deduplication: add auto-dedup on restore

if option --auto-dedup is set on restore, then as soon as page is
restored it will be punched from the image.

open image in O_RDWR mode

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
v2 test: auto-deduplication on restore

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
v2 test: auto-dedup on restore

Use maps04, on tmpfs, check if size of pages image is zero in the end

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
deduplication: add --auto-dedup option description

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
page-read: Sanitize opening routines

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