2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 21:38:16 +00:00

4796 Commits

Author SHA1 Message Date
Tycho Andersen
0ef4f01066 lib: Initialize child messages correctly
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:10:35 +04:00
Salvatore Bonaccorso
f16a08e54b Small spelling fixes in criu.8 manpage
Signed-off-by: Salvatore Bonaccorso <carnil@debian.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:09:54 +04:00
Ruslan Kuprieiev
9f8a7ccaad restore: sigreturn_restore: free core _after_ using it
Currently we have this:
	.......
	/* No longer need it */
	core_entry__free_unpacked(core, NULL);

	ret = prepare_itimers(pid, core, task_args);
	if (ret < 0)
		goto err;
	.......

So we're using ptr right after free-ing it.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:09:02 +04:00
Andrey Vagin
787e8a1d88 test/mountpoints: clean up
All mounts is marked as private for one call, so we don't need the
variable private, which has been added in "(55fe0939088d) zdtm: don't
destruct an external mount-namespace"

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-08-04 13:07:40 +04:00
Pavel Emelyanov
6ca5ac7541 cg: Merge two equal if-s into one
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-17 14:13:02 +04:00
Pavel Emelyanov
45d029f04e cg: Keep "/" in cgroup root paths
The ftw trims tail "/" from path argument.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-17 14:13:01 +04:00
Pavel Emelyanov
586eb55f35 cg: Trim proper prefix from ftw's path
After the commit that walks /proc/self/fd/N path instead of the temporary
one, the add_cgroup() started trimming first several bytes from the cgroup
path.

Test passed, since all cgroups were left as is after dump, so criu restore
didn't recreate them but got EEXIST on all mkdir-s.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-17 14:12:59 +04:00
Andrew Vagin
dda742ec57 cgroup: don't look up existing mount point
A mount point, which is mounted by someone else, may be umounted in
any moment.

For example the test system executes tests concurrently and sometimes
one test looks up a mount point, which has been mounted by another test.

==================================== ERROR ====================================
Test: zdtm/live/static/inotify00, Namespace: 1
Dump log   : /var/lib/jenkins/jobs/CRIU-dump/workspace/test/dump/inotify00/15535/1/dump.log
--------------------------------- grep Error ---------------------------------
(00.021951) Error (cgroup.c:409): cg: failed walking /var/lib/jenkins/jobs/CRIU-dump/workspace/test/dump/signalfd00/15538/1/.criu.cgmounts.UGj28v/ for empty cgroups
(00.021967) Error (cr-dump.c:1601): Dump core (pid: 15535) failed with -1
(00.025509) Error (cr-dump.c:1914): Dumping FAILED.
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================

In the previous patch I suggested to open a mount point, but it brought
other problems. We may open a directory where a cgroup mount has been
umounted and an owner will get EBUSY on attempt to remove this
directory.

Reported-by: Jenkins Criuovich
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-16 17:53:09 +04:00
Pavel Emelyanov
97f7d17905 cg: Don't walk cgroup tree when it's not required
We have two bugs actually.

First, the check for 'item == root_item' in dump_task_cgroup fires
twice: first when we rite inventory (item == NULL as argument and
root_item == NULL because we haven't yet collected tasks) and the
2nd time when we dump the root task itself.

The 2nd issue sits in dump_cgroups() -- if root_cgset == criu_cgset
we don't write cgroups information at all (checking that we don't
have them with list_is_singular() inside that if). That said, we
don't need to read the cgroups tree if we're not going to dump it.

This patch fixes both.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-16 17:31:56 +04:00
Pavel Emelyanov
9b6c41f2a0 cg: Remove unused cgroup_dir field
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-15 17:29:23 +04:00
Pavel Emelyanov
f5705fb416 cg: Minus one string copy in collect_cgroups
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-15 17:29:17 +04:00
Pavel Emelyanov
3467c3a5eb cg: Mark cgroup_contains as static
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-15 17:29:08 +04:00
Cyrill Gorcunov
cd704e80ee cgroups: Make sure the cgroup formatted correctly
In case if something is broken in the kernel and
we get a format corrupted -- simply exit out with
error instead of strlen'ing nil string.

Also while at it -- add a comment about format.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-15 17:04:11 +04:00
Tycho Andersen
0f178a1f99 cg: correctly detect co-mounted controller mount point
Before we would not detect the mount point for co-mounted controllers. Things
still worked because we'd just re-mount them ourselves and traverse our own
mount point, but this saves an extra mount().

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-14 15:14:37 +04:00
Cyrill Gorcunov
3a0ff651db protobuf: Cleanup typedefs a bit
No need to pollute typedef out of structure
statement since we don't use it in that form.
Simply typedef in place. And align members
while we're at it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-14 15:11:46 +04:00
Pavel Emelyanov
a06488ec10 show: Fix inet6 addresses showing
Was broken by d57be38c -- this one pretty show does return 1.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-14 13:31:18 +04:00
Pavel Emelyanov
9c88d34c20 show: Rename loop index 'counter' into 'i'
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-14 13:31:17 +04:00
Pavel Emelyanov
1ba5f60de4 show: Initialize field->count early
This just makes ctl->cur initialized all in one place,
but not scattered all over the code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-14 13:31:16 +04:00
Pavel Emelyanov
1cd57697b3 show: Merge fsize and show-fn getting switches
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-14 13:31:15 +04:00
Christopher Covington
24a2cec44c ZDTM build fixes
Errors building natively for x86_64 on Ubuntu 12.04:

session02.c:142:13: error: ‘PR_SET_CHILD_SUBREAPER’ undeclared

session03.c:175:13: error: ‘PR_SET_CHILD_SUBREAPER’ undeclared

vdso01.c:300: undefined reference to `clock_gettime'

Error cross compiling for arm using Linaro 14.01 toolchain:

gcc: warning: ‘-mcpu=’ is deprecated; use ‘-mtune=’ or ‘-march=’ instead
cc1: error: unrecognized command line option ‘-mfpu=neon’
cc1: error: unrecognized command line option ‘-marm’
criu-rtc.c:1:0: error: bad value (cortex-a15) for -mtune= switch
cc1: error: unrecognized command line option ‘-mfpu=neon’
cc1: error: unrecognized command line option ‘-marm’
criu-rtc.pb-c.c:1:0: error: bad value (cortex-a15) for -mtune= switch

Errors cross compiling for aarch64 using Linaro 14.01 toolchain:

maps007.c: In function ‘main’:
maps007.c:88:4: error: passing argument 1 of ‘atomic_read’ from incompatible pointer type [-Werror]
    if (futex_get(&shm->stop) && atomic_get(&shm->delta) == MAX_DELTA)
    ^
In file included from ../../lib/lock.h:10:0,
                 from maps007.c:13:
../../lib/arch/aarch64/include/asm/atomic.h:14:19: note: expected ‘const atomic_t *’ but argument is of type ‘struct f
utex_t *’
 static inline int atomic_read(const atomic_t *v)
                   ^

ptrace.c: In function ‘main’:
ptrace.c:97:15: error: ‘PTRACE_GETREGS’ undeclared (first use in this function)
    if (ptrace(PTRACE_GETREGS, stopped, NULL, regs)) {
               ^

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-11 20:39:52 +04:00
Tycho Andersen
241019b6aa cg: don't save cgroup directories twice
The path in cc->path here always has a "/" prefix since it comes from
/proc/$pid/cgroup. The additional / confuses the string slinging because ftw()
normalizes paths to have one "/" when we start traversing a subdirectory.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-11 20:37:24 +04:00
Pavel Emelyanov
ebfc37b0d9 show: Don't continue showing messages with the descriptor of nested one
When we dive into showing nested message, the call to it will
overwrite the ctl->Arg field with the descriptor of the nested
one. As a result, after the call returns we continue showing
old message with new descriptor.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-11 15:03:14 +04:00
Pavel Emelyanov
71add03823 show: Always print tabs before braces
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-07-11 15:02:51 +04:00
Pavel Emelyanov
d57be38ce9 show: Sanitze repeated fields showing routine
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-11 15:02:14 +04:00
Pavel Emelyanov
f572bc4eaf cg: Rename controllers field
We have to many controllers names in cgroup.c file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-11 15:00:51 +04:00
Pavel Emelyanov
ff90710c2e cg: Remove unused id field from controllers message
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
2014-07-11 15:00:43 +04:00
Tycho Andersen
51876eea5d Attempt to restore cgroups
During the dump phase, /proc/cgroups is parsed to find co-mounted cgroups.
Then, for each task /proc/self/cgroup is parsed for the cgroups that it is a
member of, and that cgroup is traversed to find any child cgroups which may
also need restoring. Any cgroups not currently mounted will be temporarily
mounted and traversed. All of this information is persisted along with the
original cg_sets, which indicate which cgroups a task is a member of.

On restore, an initial phase creates all the cgroups which were saved. Tasks
are then restored into these cgroups via cg_sets as usual.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-10 17:00:28 +04:00
Cyrill Gorcunov
e1b56c8fac vdso: x86 -- Drop BUG_ON if no pfn found
If pfn = 0 it means we hit something very strange
condition but better to not yield BUG_ON here,
better exit with error for future investigation.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-08 19:19:37 +04:00
Andrey Vagin
828715f9f9 jenkins/btrfs: exclude inotify_irmap
Cyrill:  we exclude these tests because of braindamaged scheme
         btrfs uses for subvolume device numbering which we don't
	 yet support in inrmaps.

Test: zdtm/live/static/inotify_irmap, Result: FAIL
==================================== ERROR ====================================
Test: zdtm/live/static/inotify_irmap, Namespace: 1
Dump log   : /mnt/btrfs/workspace/test/dump/inotify_irmap/16077/1/dump.log
--------------------------------- grep Error ---------------------------------
(00.024342) Error (irmap.c:80): irmap: Can't stat /var/spool: No such file or directory
(00.024365) Error (irmap.c:80): irmap: Can't stat /lib/udev: No such file or directory
(00.024378) Error (irmap.c:80): irmap: Can't stat /no-such-path: No such file or directory
(00.024383) Error (fsnotify.c:184): fsnotify: Can't dump that handle
(00.024397) Error (cr-dump.c:1563): Dump files (pid: 16090) failed with -1
(00.024779) Error (cr-dump.c:1911): Dumping FAILED.
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-08 19:18:39 +04:00
Andrey Vagin
77391fa795 test/jenkins: add job to test pre-dump
Make pre-dump twice and then dump and restore.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-08 19:18:37 +04:00
Andrey Vagin
19df5ec472 tcp: don't forget to wake up the port->users futex
Reported-by: Robert Reinecke <reinecke@rbg.informatik.tu-darmstadt.de>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-08 17:43:54 +04:00
Pavel Emelyanov
3435ec9ee5 Add 50K'th line in the source code
As per current top commit (9c0c23c0) the amount of code in CRIU
_without_ the contents of the test/ directory is

$ git grep -l . | egrep -v ^test | xargs wc -l
...
49999

This is the only chance for such a great one-liner :)

The place in the code is not completely random -- it's one of the
few occurrences of two consecutive empty lines in a .c file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Tested-by: Andrew Vagin <avagin@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Ruslan Kuprieiev <kupruser@gmail.com>
2014-07-08 17:38:52 +04:00
Pavel Emelyanov
9c0c23c067 files: Don't unlink ghost directory
It will be rmdir-ed a bit later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:55:52 +04:00
Pavel Emelyanov
49f27969f5 files: Don't fail on missing fs.img for zombies
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:52:29 +04:00
Pavel Emelyanov
e2ab347415 files: Initialize remap->is_dir for linked remap (to false)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:52:09 +04:00
Pavel Emelyanov
061d69614a zdtm: Pick up deleted unix socket test (v2)
CRIU doesn't support relative unix sockets paths, so
tune the test to use absolute.

(v2: Off-by-one spotted by Filipe)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:13:41 +04:00
Andrey Vagin
d3819b756f test/socket-tcpbuf: add heartbeat to make blood flow in the connection
Otherwise the connection can be disconnected due to a timeout, because
the kernel may drop packets from a receive queue (RcvPruned in
/proc/net/netstat).

Half of buffers always stay in the socket, another half is circulated.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:09:57 +04:00
Andrey Vagin
437aff387a zdtm/socket-tcpbuf: add shortcuts for RDWRing a specified size of data
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:09:46 +04:00
Pavel Emelyanov
7efbdf2de4 zdtm: Add test for cwd and opened ghost directory
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:09:08 +04:00
Pavel Emelyanov
5be15df097 zdtm: Add test for cwd ghost directory
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:09:07 +04:00
Pavel Emelyanov
a919dbc9c6 files: Fix restoration of ghost cwd (and root)
When cwd is removed (it can be) we need to collect the respective
file_desc before starting opening any files to properly handle
ghost refcounts. Otherwise we will miss one refcount from the
cwd's on ghost, which in turn will either BUG inside ghost removal,
or will fail the cwd due to the respective dir being removed too
early.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:09:06 +04:00
Pavel Emelyanov
ba8671b4c1 files: Split open_reg_by_id into two parts
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:09:04 +04:00
Pavel Emelyanov
9b91bf390d files: Split fs restore into prepare and restore
The prepare one will become more complicated soon.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:09:03 +04:00
Pavel Emelyanov
b8d01d1b7a files: Rename prepare_fs into restore_fs
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:09:02 +04:00
Pavel Emelyanov
471d73e343 zdtm: Add test for opened ghost directory
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:09:01 +04:00
Pavel Emelyanov
d0097b2db0 files: Support ghost directories restore
If we have opened and rmdir-ed directory, the dump works OK
creating the ghost file and remap, but restore creates _file_
instead of directory.

Fix this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 15:08:59 +04:00
Tycho Andersen
c06727c2d1 cgroup: rename controller_entry to cg_member_entry
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-04 14:38:26 +04:00
Andrey Vagin
8937bf7a72 test: add mounts/ext in the "other" list
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-03 19:21:20 +04:00
Pavel Emelyanov
daccf5ec97 zdtm: Add more verbosity to deleted_dev failure
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-03 13:29:09 +04:00
Pavel Emelyanov
0ce9ce408a zdtm: Fix deleted_dev and add to the runlist
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-03 13:29:04 +04:00