2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 05:48:05 +00:00

4636 Commits

Author SHA1 Message Date
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
Pavel Emelyanov
a9f765894e files: Support ghost devices
When we have opened and unlinked chr or blk device, we
shouls also take care of their rdev value. Thus -- new
field in image and some new steps on dump and restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-03 13:28:56 +04:00
Pavel Emelyanov
8e21401aa2 files: Split ghost collecting routine
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-03 13:28:41 +04:00
Pavel Emelyanov
731dc18332 zdtm: Pick up some tests that pass
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:14:14 +04:00
Pavel Emelyanov
0198590c5a zdtm: Factor out starting the test via Makefule
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:52 +04:00
Pavel Emelyanov
2fc837917f zdtm: Don't build test for the 2nd time
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:51 +04:00
Pavel Emelyanov
8eb1d662bf zdtm: Factor out getting pid of test
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:49 +04:00
Andrew Vagin
693bf79ffd test: add a script for jenkins to execute non-zdtm tests
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:17 +04:00
Andrew Vagin
2eb0a6b6cb test/meme-snap: remove an nonexistent target
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:13:11 +04:00
Pavel Emelyanov
f6111769c3 zdtm: Introduce per-test criu options
Some tests require custom options for dump and restore. Instead
of hard-coding test names into zdth.sh, introduce the $test.opts
file from which zdtm would pick the needed options.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:12:36 +04:00
Pavel Emelyanov
6021378ca6 zdtm: Introduce $cpt_args
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-07-02 12:12:35 +04:00