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

1528 Commits

Author SHA1 Message Date
Pavel Emelyanov
decf115f7e zdtm: Wait for test finish with increasing intervals
This makes tests that finish some time run smoother -- no tons of Waiting... messages
on the screen

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 07:57:23 +04:00
Pavel Emelyanov
7ea40df4db pipe/fifo: Remove unused members from rst structures
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 08:56:20 +04:00
Pavel Emelyanov
d448a75ec7 pipe/fifo: Fix and cleanup data restore
Make it in two stages.

First -- collect pipe data into hash without checking for pipe/fifo existance.
Next -- when pipe/fifo gets restored walk the hash and search where the pipe data
is.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 08:55:16 +04:00
Pavel Emelyanov
3aa01f649f pipe: Don't intermix pipe and fifo data when dumping
The existing code checks for ID to be already dumped. But pipe and fifo may have the same ID
since they reside on different filesystems.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 08:21:54 +04:00
Pavel Emelyanov
499cc6789b pipe: Remove ID arg from pipe data dump fn
This routine checks for pipe data being dumped based on pipe ID, but the arg in questoin
is the pipe's end ID which makes code reading confusing.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 07:50:39 +04:00
Pavel Emelyanov
e23c9e0cda inet: Report error if inet socket collect failed
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-10 12:56:54 +04:00
Pavel Emelyanov
a135b40ba2 ghost-files: Merge dump and restore helper structs
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 06:25:34 +04:00
Pavel Emelyanov
218f0a9b5c fifo: Fix false failure on fifo image reading
The ret var is set to -1 at the beginning and the very first loop
will break and report it to the caller thus stopping the restore :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 06:25:29 +04:00
Cyrill Gorcunov
883126a475 inotify: Use embedded structures as a reference
We need it for protobuf transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-10 07:01:32 +04:00
Cyrill Gorcunov
5f303989eb eventpoll: Use embedded structures as a reference
We need it for protobuf transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-10 07:01:16 +04:00
Cyrill Gorcunov
f382fcf838 eventfd: Use eventfd_file_entry in eventfd_file_info as a reference
We will need it for protobuf transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-10 07:00:55 +04:00
Cyrill Gorcunov
c553627ddd fifo: Use fifo_entry in fifo_info as a reference
We will need it for protobuf transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-09 15:08:36 +04:00
Cyrill Gorcunov
2db18f5e16 files: Use fdinfo_entry * in fdinfo_list_entry structure
We will need to use pointer here (to PB object) anyway
so better to make it in a separate patch for bisectability sake.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-09 15:04:35 +04:00
Cyrill Gorcunov
30f1aff658 Update .gitignore
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-09 15:03:38 +04:00
Cyrill Gorcunov
7ff9efda4a zdtm: fifo-rowo-pair test update
Address Andrew's comments

 - use TEST_VALUE macro instead of open coded value
 - use WIFx macros for child status testing
 - kill child/parent on error

Note that it was not clear from an initiall patch
change log -- the difference between fifo_wronly
test case and this one is that we use fork() call
here which allow us to make sure that fifo restoration
code logic will be tested more widely.

Basically the flowchart of the test case:

parent				child
------				-----
open RW fifo (slave)
open RO fifo (master)
				open WO fifo (master)
				dup parent slave to slave1

				... waiting c/r to happen ...
				... waking up from c/r ...

				send bytes to master
				send bytes to slave1

				finish
... initiating c/r ...
... waking up from c/r ...

read bytes from master
read bytes from slave

PASS :D

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-02 16:56:01 +04:00
Andrey Vagin
d249c293f7 restore: create fake process group leaders
Just like for orphaned sessions, create a fake task for orphaned pgids.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-02 16:53:56 +04:00
Andrey Vagin
6fb3759c5f restore: restore pgid in two phases
As described in the previous patch, process group leaders are restored in
the first phase, then all other processes restores pgid.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-02 16:53:55 +04:00
Andrey Vagin
5c45786417 restore: wait while restroring pgid (v2)
Pgid leader should become such before any other task tries
to enter this group (with setpgid). Thus we introduce a yet
another global sync point -- before it all pgid leaders call
setpgid after it all the others do it.

v2: wait while helpers restored pgid

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-02 16:53:54 +04:00
Andrey Vagin
63dcf183f2 zdtm: add a test case for checking sid and pgid
A process tree is described in the array. New cases are easy for adding.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-02 16:53:52 +04:00
Andrey Vagin
23501ffe32 zdtm: add ability to set id of a test proccess
It's just easy for debugging

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-02 16:53:51 +04:00
Andrey Vagin
faf12f405b zdtm: copy futex engine from crtools (v2)
We can't reuse it from crtools, because zdtm is used separately.

v2 syscall() returns an error code in errno.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-02 16:53:50 +04:00
Pavel Emelyanov
b1919be8bb pipes: Cleanup pipe data collecting code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-28 13:32:59 +04:00
Pavel Emelyanov
3b8fef5227 fifo: Sanitize fifo restore
Don't push open cb onto reg_file_into, pass it into regfiles engine
as an argument.

Note: I haven't merged the fifo zdtms yet, thus this patch is untested.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-07-01 21:47:24 +04:00
Cyrill Gorcunov
18d8950355 zdtm: Enable fifo and fifo_wronly tests
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 21:45:35 +04:00
Cyrill Gorcunov
c8bf5e3fd0 zdtm: Add fifo ghost file test
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 21:45:18 +04:00
Cyrill Gorcunov
e0939577ea zdtm: Add fifo-rowo-pair test case
I need a special test case where fake
fifo will be created by us to restore
the former.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 21:44:59 +04:00
Cyrill Gorcunov
ea1ce8e472 fifo: Add checkpoint restore for fifos v4
Checkpoint and restore of fifo is similar to
pipes c/r except the pipe end-points are named
file.

Because the fifo has a name we use regular files
facility for fifo path c/r.

Still there is a trick used to "open" fifo:
the opening procedure migh sleep if a fifo's peer
is not yet opened, so before doing a real open
we yield a fake open procedure (with O_RDWR flag)
which prevents us from sleeping even if peer
is not yet ready. Also we need writable fifo
end to restore data queued.

v2:
 - add open/priv members to reg_file_info
 - make open_fifo_fd to use open_fe_fd
 - comment on pipe_id
 - make sure the fifo data is not restored twice

v3:
 - drop useless fixme comment and add sane one
v4:
 - Use restore_data flag to escape data restore duplication
 - Use S_ISREG for file contents copying

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 17:15:48 +04:00
Cyrill Gorcunov
18145c50c1 files-reg: Create fifo ghost node if needed v2
Allow file path remap engine to create fifo nodes.
Note for fifos the copy_file is not called since
we will restore fifo data via pipe-data engine.

v2
 - no need for dev in mknod
 - don't reopen local copy on fifo files

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 17:14:32 +04:00
Cyrill Gorcunov
d16d4baa8d pipes: Make dump_one_pipe_data/restore_pipe_data being non-static
To reuse with fifo data restore.

v2:
 - use image type in functions arguments instead of forcing
   calling side to provide file descriptor

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 17:13:11 +04:00
Cyrill Gorcunov
18ede23c49 inotify: Tune up fdinfo format for new kernel output
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 15:35:54 +04:00
Cyrill Gorcunov
eeb8f763b0 eventfd: Tune up fdinfo format for new kernel output
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 15:35:40 +04:00
Andrey Vagin
16c410b19f zdtm: check content of an unlinked file
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 15:34:24 +04:00
Cyrill Gorcunov
29cb7de198 zdtm: Turn on unbound_sock test case
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 14:43:24 +04:00
Cyrill Gorcunov
37131e51b1 sockets: Restore unbound inet sockets v5
v2:
 - Use do_dump_opt in dump_socket to not call
   lookup_socket redundantly

v3:
 - use getsockopt to check that unconnected
   socket has no peername and it's not listening
 - do test only socket protocol since family and
   type will be called in dump_one_inet_fd.

v4:
 - Move proto tests to can_dump_inet_sk
 - Use SOL_TCP/TCP_INFO to gather info about tcp sockets

v5:
 - hash unconnected sockets to run BUG_ON(already-dumped) logic
 - no default value for sk->wqlen, use zero from xzalloc
 - drop bogus xfree on error

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-01 14:42:42 +04:00
Andrey Vagin
877f8c8276 zdtm: simplify sys_gettid
It fix compilation on x32

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-28 20:54:12 +04:00
Pavel Emelyanov
2c978d84d3 crtools: Celan crtools.c from unneeded headers
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-28 03:15:01 +04:00
Pavel Emelyanov
611b97248b img: Move all the img files management code to image.c
And clean util.c and crtools.c from image manupulation code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-28 03:12:08 +04:00
Evgeny Antyshev
dc2a99c627 zdtm: allow for 0 timer growth in uptime_grow
It may occur that the loop spins faster than clock ticks.

Signed-off-by: Evgeny Antyshev <eantyshev@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 21:08:42 +04:00
Andrey Vagin
49c1d43645 pstree: move all code about pstree in a separate file
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Looks-cool-to: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 21:07:30 +04:00
Andrey Vagin
18cd74069c zdtm: don't print useless numbers
expr prints a substing length. This patch redirects output of expr to /dev/null

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 21:05:08 +04:00
Andrey Vagin
8abf475d59 zdtm: make zdtm.sh faster in two times
It requered 1m19s for executing all tests.
Now it requires 38s.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 21:04:37 +04:00
Cyrill Gorcunov
486da8827e zdtm: Convert caps00 test to use task_waiters
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 21:03:45 +04:00
Cyrill Gorcunov
8d7a55ed74 zdtm: Add task_waiter_ helpers v3
Sometime we need sync points in testee program flow,
for this reason task_waiter_ introduced.

The call semantics is the following

        Parent                  Child
        ------                  -----
        task_waiter_init
                                task_waiter_wait4
        task_waiter_complete
                                task_waiter_wait4
        task_waiter_complete

                ...

Thus initially task_waiter_init should be called
to initialize all internals guts needed.

Then one become waitee and calls for task_waiter_wait4,
where lockid should be provided as an argument. Since
it should be unique values the best option might be
gettid().

The same applies to a waiter side -- it should call
for task_waiter_complete and provide a lockid.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 21:03:31 +04:00
Pavel Emelyanov
43f62f42b2 rst: Close standard descriptors before fds restore
Strictly speaking we have to close all fds before reopening them from the
image. This can be done using not yet merged nextfd syscall, but it's not
yet merged :( By now just close std and 255 (bash's) descriptors. This is
ugly, but I prefer to wait for the nextfd syscall.

But skip the init tasks' stds becase the existing zdtm implementation
uses system() in such tasks which doesn't work when all fds are closed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 20:57:42 +04:00
Pavel Emelyanov
a03323e162 zdtm: Basic test for mount points in mount namespace
Test with sysfs and proc as no other fs-s are currently supported.
Will be fixed later.

Note, that the original /proc mount is kept as the dumping code requires
it for reading pagemap file with RSS info. Worth fixing it some day?

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 20:57:41 +04:00
Pavel Emelyanov
a201f59816 rst: Create custom proc every time we restore a namespace
We need own proc for restoring mount namespace, since the proc should
be umounted and mounted back diring namespace restore and I don't want
to introduce a special kludge for this.

One more notice -- the temp proc is mounted _after_ namespaces recreation
for the same reason (it will be umounted by prepare_mnt_ns).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 20:57:40 +04:00
Pavel Emelyanov
fe41f84b42 mount: Mounting code core
Only support virtual filesystems mount. No bindmounts or disk fs
due to non trivial resolving of devices names and binmount sources.
Will be implemented later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 20:57:39 +04:00
Pavel Emelyanov
1adb7d2416 mount: Umount a mountpoint when iterating
The tree should already be sorted, thus the call for umount shouldn't fail.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 20:57:38 +04:00
Pavel Emelyanov
f0c68e7361 mount: Tree walking functions
Two walkers -- in forward and reverse directions -- are required
for correct (u)mounting of subtrees. Implement them using a helper
macro which walks the tree in both directions.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 20:57:37 +04:00
Pavel Emelyanov
95964f1b13 mount: Core for creating mount namespace
Namespace restore goes in two steps -- first, clean old mountpoints
(except root) that are left after clone(CLONE_NEWNS) call. Next,
repopulate the namespace with new mountpoints (except root) read
from the image file.

This patch adds the skeleton for the above -- reading the mountpoints
from current proc and image and calling for mount/umount. The real
action will come in further patches.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-27 20:57:36 +04:00