2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-05 08:45:49 +00:00
Commit Graph

4636 Commits

Author SHA1 Message Date
Alexander Kartashov
16ebfa1656 arm: parasite: implement arch_get_tls() in C
This patch should simplify the routine interface change
in the following patch.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-11 22:39:22 +04:00
Cyrill Gorcunov
a247426ca1 fsnotify: Fix nil dereference in pre_dump_one_fanotify
pre_dump_one_fanotify calls for parse_fdinfo_pid_s where
fsn_params mut not be NULL, otherwise we get nil dereference.

Fix it by passing a real variable instead.

Reported-by: Pavel Tikhomirov <snorcht@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-11 22:20:13 +04:00
Andrey Vagin
485766bc38 zdtm: check posix_timer with sival_ptr = NULL
Here is a regresion test cae for

commit 1934e1a963
Author: Andrey Vagin <avagin@openvz.org>
Date:   Tue Feb 18 16:53:00 2014 +0400

    posix-timer: take into account that sival_ptr can be NULL (v3)

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-11 22:17:17 +04:00
Saied Kazemi
8d8d638454 pie: Fix pie.lds.S.in script to work with the gold linker
The pie.lds.S.in needs two minor changes to work with the gold (/usr/bin/gold)
linker. These changes are compatible with /usr/bin/ld and make linker script
more portable.

The first change is adding a comma before /DISCARD/ so that the grammar
won't be ambiguous. A Otherwise, gold treats it as a part of the assignment
and would generate a syntax error about the "unexpected ':'".

The second change is moving initialization of __export_parasite_args
to inside the SECTIONS command because it references the dot symbol.
Otherwise, gold would generate the error "invalid reference to dot
symbol outside of SECTIONS clause.

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-11 22:15:02 +04:00
Pavel Emelyanov
21be99515a dedup: Plring iov->len + ulong with %lu format
Fix for the previous patch :\

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-07 17:51:38 +04:00
Pavel Emelyanov
0176b8afd0 dedup: Print iov->len with %zu formap
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-07 16:49:00 +04:00
Pavel Emelyanov
343d7c824d irmap: Add /lib/udev into hints, fake path and logging
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-07 16:46:16 +04:00
Pavel Emelyanov
997c6dd479 fsnotify: Don't scan irmap for tempfs
On this fs path can be resolved via proc, so even if
we're asked to do force-irmap, try to go via regular
resolve anyway.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-07 16:45:33 +04:00
Pavel Emelyanov
909c5d7fab dedup: Print punch offset with %p format
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-07 14:41:24 +04:00
Pavel Emelyanov
fed36de049 dedup: Cleanup checking whether we batch punching or not
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-07 14:40:05 +04:00
Tikhomirov Pavel
32a48b67b7 v2 deduplication: bunch neighbour data to punch together
when decide that data is no longer needed, there are two cases:
-if data neighbours previous block of "no needed" data, extend bunch
block(it holds begining and size of concequent "no needed" data) by
length of curent block and go next.
-if data not neighbours bunch block(or bunch block size will be bigger
than MAX_BUNCH_SIZE), than we punch bunch block and set bunch block
to curent block.

in the end make cleanup to punch last bunch block.

changes in v1:
punch_hole takes whole page_read
make restriction more precise

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-07 14:31:29 +04:00
Cyrill Gorcunov
8ed215d252 proc_parse: Borrow vmi iif there is file referenced
Otherwise we migh propagate previous vfi status
to vmas which actually don't match.

 | (00.005471) 0x2b79227d6000-0x2b79227d8000 (8K) prot 0x5 flags 0x22 off 0 reg vdso ap  shmid: 0
 | (00.005473) 0x2b79227d8000-0x2b79227da000 (8K) prot 0x3 flags 0x22 off 0 reg vdso ap  shmid: 0
 | (00.005475) 0x2b79227f1000-0x2b79227f2000 (4K) prot 0x3 flags 0x22 off 0 reg vdso ap  shmid: 0
 | (00.005476) 0x2b79227f2000-0x2b79227f4000 (8K) prot 0x3 flags 0x22 off 0 reg vdso ap  shmid: 0

Tested-by: Pavel Tikhomirov <snorcht@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-06 21:32:15 +04:00
Tikhomirov Pavel
c3d71138ec deduplication: fix bug in auto-dedup when it is on page-server
No need to check opts.use_page_server, because in write_pagemap_loc
write is local anyway. it appeared that on page-server when saving
pages to images opts.use_page_server=true and no auto-dedup started,
so images were not null as expected.

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-06 16:52:40 +04:00
Pavel Emelyanov
9db426a7cd irmap: Properly compare stat vs proc devices
The s_dev value we see in irmap is get from proc file and is
raw kernel dev_t. We compare this value to the device get from
stat syscall, which is old-style dev_t (with less bits for minor).

Thus, need to convert kernel dev_t to stat's dev_t for proper
comparison.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-06 15:14:04 +04:00
Pavel Emelyanov
edde5fb461 irmap: Add option that forces fsnotify watches paths resolve
When migrating container with copying its FS, the inode numbers
and thus their handles wil change. This will make the restore of
inotify/fanotify fail, since they do it via fhandles.

We've already faced the problems with fsnotifies on NFS -- they
don't work there. To address this an irmap cache is created on
pre-dump, so to resolve the issue with changed inodes during
migration, we can force the irmap cache build.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-06 15:12:05 +04:00
Pavel Emelyanov
5da52f6aec page-xfer: Don't expect that page server cmd is read in one call
There's a standard way of doing this -- the MSG_WAITALL flag that
works even for TCP sockets.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-06 13:09:56 +04:00
Pavel Emelyanov
eaee604238 Revert "util: Add "/bin" to PATH when spawning helpers"
This reverts commit 66ab5e1ad8.

After Andrey's fixes that create mount points before dropping
old mounts and going to pivot_root, this patch is not needed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-04 22:18:17 +04:00
Andrey Vagin
e61259a82f mount: mark all mounts as private in one place
This should be done before restoring a mount tree. This patch is a part
of the series about moving pivot_root, which has been committed.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-04 22:01:17 +04:00
Cyrill Gorcunov
f0b5bedfa5 libcriu: Add criu_set_cpu_cap helper
To setup cpu capability mask.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 20:34:42 +04:00
Cyrill Gorcunov
09c810142c service: Add setup of @cpu_cap from rpc request
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 20:34:41 +04:00
Cyrill Gorcunov
073c0bca6d protobuf: rfc -- Add cpu_cap option
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 20:34:40 +04:00
Andrey Vagin
223a998265 zdtm/tempfs: check that overmounted parts are restored (v2)
v2: check that plain file opened on tempfs
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 20:32:51 +04:00
Andrey Vagin
226945460f mounts: make pivot_root after restoring mount points
We are using tar for resting tmpfs. Currently we execute tar from a
restored root, but nobody guarantees that it is there and that it's
really tar.

We don't have reason to change root too early. Lets live in a source
root as long as we can, because we can be sure that it's consistent.

https://bugzilla.openvz.org/show_bug.cgi?id=2870

v2: remove redundant chdir()
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 20:32:43 +04:00
Andrey Vagin
31f2f79519 mounts: use relative paths for mountpoints (v2)
We are going to restore mounts before changing root. For that the
current dir is changed in a new root and mounts will be restored by
relative paths.

v2: don't use snprintf
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 20:30:49 +04:00
Andrey Vagin
245fa6ea56 mount: change cwd on the root before restoring mntns (v2)
We are going to make pivot_root after restoring mount name-space,
so relative paths will be used for mountpoints.

v2: print correct root in a error message
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 20:30:44 +04:00
Pavel Emelyanov
7e096fb1c9 xfer: Don't print warning abount non-flushed data in case of other error
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 16:20:38 +04:00
Pavel Emelyanov
391e4bd7b9 page-read: Sanitize opening routines
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 15:19:19 +04:00
Tikhomirov Pavel
6c0bed950a deduplication: add --auto-dedup option description
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 14:14:12 +04:00
Tikhomirov Pavel
f65714de1b 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>
2014-02-28 14:12:18 +04:00
Tikhomirov Pavel
0766cf39c0 v2 test: auto-deduplication on restore
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 14:12:00 +04:00
Tikhomirov Pavel
f0a6d32cd4 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>
2014-02-28 14:11:49 +04:00
Tikhomirov Pavel
a355affd29 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>
2014-02-28 14:10:51 +04:00
Cyrill Gorcunov
9b491e5c68 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>
2014-02-28 13:36:43 +04:00
Cyrill Gorcunov
056047bdf9 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>
2014-02-28 13:36:38 +04:00
Cyrill Gorcunov
ad0f698055 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>
2014-02-28 13:34:31 +04:00
Cyrill Gorcunov
eee9ad2b44 log: Add pr_warn_once helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:34:29 +04:00
Andrey Vagin
8dd4134189 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>
2014-02-28 13:30:22 +04:00
Andrey Vagin
5fab7f3239 maps007: save core files in a error case
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:29:31 +04:00
Andrey Vagin
deb61cdbe6 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>
2014-02-28 13:27:48 +04:00
Andrey Vagin
06662f9f13 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>
2014-02-28 13:26:48 +04:00
Andrey Vagin
e16f0976fc 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>
2014-02-28 13:18:44 +04:00
Andrey Vagin
8ce7ef75ec 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>
2014-02-28 13:18:43 +04:00
Andrey Vagin
1b16fa048c 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>
2014-02-28 13:09:32 +04:00
Andrey Vagin
1a89dbb5da 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>
2014-02-28 13:09:19 +04:00
Cyrill Gorcunov
204599aa65 headers: Use fs-magic.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 13:08:00 +04:00
Cyrill Gorcunov
6e95f544de 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>
2014-02-28 13:07:54 +04:00
Pavel Emelyanov
402101c345 criu: Version 1.2 release
This time we've made minimal required support for live-migration,
so that the p.haul project can work. Another big achievement is
better dump and restore performance.

Other than this -- a lot of bugfixes here and there, as usual.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
v1.2
2014-02-26 16:50:39 +04:00
Cyrill Gorcunov
e15914fb08 fsnotify: Open handle with O_PATH, v2
Otherwise if the mark is set up on link we end
with -ELOOP error trying to open it. Thus, use
O_PATH pointing the kernel that we're not going
to read/write this descriptor.

Repored-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-25 23:38:35 +04:00
Andrey Vagin
6209ff4567 fsnotify: print correct error if open_by_handle_at failed
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-25 12:01:32 +04:00
Pavel Emelyanov
d98925d512 files-ext: Mark dump callback as static
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-24 17:30:42 +04:00