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

1528 Commits

Author SHA1 Message Date
Andrey Vagin
c8e6be95e4 restore: create pid namespace
A pid namespace is created if a pid of the first task is 1.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 22:16:19 +04:00
Andrey Vagin
83e6d14efd cr-dump: split collect_dump_pstree to collect and dump
When we dump pid ns, dump_pstree is called after dump_tasks

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 22:16:10 +04:00
Andrey Vagin
772edd462c parasite: add ability to get pid and tid
If we try to dump a process from another pid ns,
we have not another way to get its pid.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 22:16:01 +04:00
Andrey Vagin
4b48849c32 ctrools: prepare to dump pid namespace
Add struct pid and use it everywhere. This struct contains
two fields: pid and real_pid.

real_pid is a pid outside of the target pid namespace.
pid is in the target pid namespace

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 22:13:52 +04:00
Cyrill Gorcunov
2adbbcba89 pipes: Don't forget to init pipe_info::create
Otherwise its value might be taken from heap (it's xmalloc'ed).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:45:18 +04:00
Cyrill Gorcunov
70b65c9a50 pipes: Don't call for restore_fown if open failed
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:33:09 +04:00
Cyrill Gorcunov
6b06c744db pipes: Style tune up for pipe_info members
- align members
 - comment with empty line

No func changes.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:32:14 +04:00
Cyrill Gorcunov
f973fcabb9 pipes: Shrink pipe_should_open_transport to want_transport
It's static function near the file_desc_ops,
no need for a long name.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:30:36 +04:00
Cyrill Gorcunov
61e289f184 pipes: Reorder functions
Checkpoint and restore do use fdtype_ops
and file_desc_ops intensively so reorder
pipes functions, this allow us to make
them static and drop additional declarations.

No func changes.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:30:03 +04:00
Cyrill Gorcunov
f3c93470e1 pipes: Get rid of dangling line in dump_pipe
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:29:24 +04:00
Cyrill Gorcunov
28cd2a7633 pipes: Add missing void into func arguments
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:28:53 +04:00
Cyrill Gorcunov
9981b6a6d3 pipes: Eliminate parasite \t
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:27:37 +04:00
Cyrill Gorcunov
ac52abd83e pipes: Make pipes_with_data being static
There is no need to make it xmalloc'ed, it's
global for all processes dumped.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:27:10 +04:00
Cyrill Gorcunov
e6f6c9f1fb pipes: Make dump_one_pipe to use dump_one_pipe_data
xemul: Why we haven't done this earlier? Because the pe entry contained the
amount of bytes in the pipe and this value had to be calculated before we
wrote this entry into the image. Now the pipe data is stored in another img
file and we can happily split pe dump and pde dump into two calls.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:19:45 +04:00
Cyrill Gorcunov
8c54d8d932 pipes: Add dump_one_pipe_data helpers
Will need it for fifo data dumping. At moment
the helper is pushed out of compilation procedure
for easier review, and will be real used in next
patch.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:19:43 +04:00
Cyrill Gorcunov
2738fae816 types: Add PAGE_MASK
Will need it for pipes data dumping.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 15:19:42 +04:00
Cyrill Gorcunov
6835e2ad98 pipes: Rename PIPE_NONALIG_DATA to PIPE_MAX_NONALIG_SIZE
And make it dep. on PIPE_DEF_BUFFERS, this points to
a limit from kernel side.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 13:33:25 +04:00
Cyrill Gorcunov
afee2e0f36 files: Print symbolic meaning of file restoring status
|	Restoring fd 5 (state -> create)
 |		Create fd for 5
 |			Going to dup 5 into 5
 |	Restoring fd 0 (state -> receive)

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 13:28:11 +04:00
Cyrill Gorcunov
3eade0b6d5 zdtm: ipc_namespace -- Make sure queues_max is not out of range value
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 13:24:46 +04:00
Andrey Vagin
e15babbd96 restorer: exit all threads in case of error
sys_exit() takes down only the currect thread. exit_group() should
be used to take down all threads.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Looks-good-to: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 12:45:44 +04:00
Victor Konyashkin
e2ba4892ca zdtm: If address already in use then need increase port.
If address already in use then need increase port.
The problem occured because the socket_listen.c и socket_aio.c
can try to use the same address.

Signed-off-by: Victor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 12:44:53 +04:00
Cyrill Gorcunov
49c857484c files: No need to split file_desc_add declaration
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 12:43:23 +04:00
Cyrill Gorcunov
96e5b7bbd3 files: Rename file_descs to file_desc_hash
That is what it is -- a hash for file
descriptors based on their ID.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 12:41:42 +04:00
Andrey Vagin
ad41b1e9c9 zdtm:fifo: check that read only fifo descriptor is restored
* Create fifo and two descriptors rw and ro
* Write data and close rw descriptor
* Suspend/resume
* Read data from ro descriptor

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 12:40:51 +04:00
Andrey Vagin
542abe80a2 zdtm:fifo: write a few data in the fifo descriptor and check them
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 12:39:58 +04:00
Cyrill Gorcunov
1177299b41 make: LIBS should not be in prerequisites
Use them explicitly. This fixes problem

 |  LINK     crtools
 | /usr/lib/librt.so: could not read symbols: File in wrong format
 | collect2: ld returned 1 exit status
 | make[1]: *** [crtools] Error 1
 | make: *** [all] Error 2

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Kinsbursky Stanislav <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-19 12:37:36 +04:00
Andrey Vagin
1f9acbabbb syscall: add +__NR_getpgid +__NR_getsid
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-04 12:53:33 +04:00
Cyrill Gorcunov
24c98006dd dump: Don't dump file params with on-stack values in dump_task_fs
Ad addition to commit 63000f5bb20e12ced2bc9662482775d163c97c5a,
this place was missed to fix.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-04 12:50:57 +04:00
Cyrill Gorcunov
b6b9e8dc6d zdtm: Cleanup file_fown test case (v2)
- add test for flags recovery
 - drop sockets, not needed
 - simplify test for owners and signumber

v2: remove polling (by avagin@)

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-06-04 12:38:32 +04:00
Andrey Vagin
0eb0391ce0 util: do a control shot from BUG_ON
SIGABRT may be blocked. We do that in the restorer.

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-01 18:44:16 +04:00
Kinsbursky Stanislav
afd9559d57 make: fix blob dependencies
v5:
1) make change directory messages supressed.

v4:
1) Fixed apply conflicts.

v3:
1) "crtools" goal dependences fixed.

v2:
1) wrong "protobuf/tmp.pb-c.h" inclusion removed from cr-dump.c

Without this patch "touch parasite.c" will lead to rebuild of the whole
project.
This patch also introduces "pie" goal as a subsystem. This will be usefull,
when other subsystems will apper, because it allows to build them in parallel.
"all" becomes default goal. This allows to skip deps inclusion for empty,
"all", "zdtm" and "test-legacy" goals.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-31 15:52:57 +04:00
Andrey Vagin
dfdf54d96b pstree: allocate restore data as a tail of pstree_item (v2)
v2: Synchronize the argument type of __alloc_pstree_item and the
values you put into it. I.e. int-int or bool-bool, not bool-int.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-31 15:41:05 +04:00
Andrey Vagin
f7d0263c69 restore: add fast path to find a parent pstree item
Taking into account the way the dump saves pstrees in the image.

If pstree.img isn't edited, a slow path should not be executed at all.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-31 15:41:03 +04:00
Andrey Vagin
cf63c1d9e8 crtools: link pstree_item-s in a tree (v3)
because they describes a process TREE.

It's usefull, when we dump tasks from another pid namespace,
because a real pid is got from parasite. In previous version
we need to update pid in two places one is in a pstree_item and
one is in a children array.

A process tree will be necessery to restore sid and pgid,
because we should add fake tasks in a tree. For example if
a sesion leader is absent.

v2: fix rollback actions
v3: fix comments from Pavel Emelyanov
    * add macros for_each_pstree_item
    * and a few bugs

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-31 15:41:02 +04:00
Cyrill Gorcunov
ced64e22c0 files: Don't mask O_ASYNC flag from being set
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-31 15:15:20 +04:00
Cyrill Gorcunov
9589932561 zdtm: Add sockets_dgram test case
Code to test unix dgarm sockets (extracted from
previous sockets00 test case).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-31 15:12:15 +04:00
Cyrill Gorcunov
96c3c7bea4 zdtm: Add sockets_spair test case
Code to test socketpair (extracted from
previous sockets00 test case).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-31 15:11:56 +04:00
Cyrill Gorcunov
7dad6fcfdf zdtm: Cleanup sockets00
Don't mix various types of sockets in a single
test case, in case of problems it become harder
to fins which kind of socket failed.

The removed test cases will be addressed in
further patches.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-31 15:11:54 +04:00
Pavel Emelyanov
eeabd33219 show: Beautify fdinfos showing
Shifd fd and type left and print ID with %#x

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-17 10:57:06 +04:00
Pavel Emelyanov
03b06a8b65 unix: Beautify the unixsk image show output
Print IDs with %#x to get rid of spaces between 0x and numbers.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-17 10:56:29 +04:00
Kinsbursky Stanislav
e4a41e8c48 make: prepare crtools build for submake calls
The reason for this patch is that only phony goal can depend on phony targets.
But with protobuf we will have to execute phony targets prior to main target
build.
So, this patch set add few new goals and dependences:

1) "all" become default goal.
2) new goals "deps" and "preq" introduced.
3) "all" depends on "deps" and "crtools".
4) All global goals like "zdtm" and "test-legacy" now depends on "all".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 15:11:46 +04:00
Kinsbursky Stanislav
c2e699982c make: echo deps build
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 15:11:04 +04:00
Kinsbursky Stanislav
4f9b66f074 make: specify DEPS implicitly
Instead of using wildcard expressions like "*.c" lets implicitely specify
desired dependence files.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 15:09:45 +04:00
Kinsbursky Stanislav
ba824193ec make: make "all" as phony target
Also, .PHONY have to be specified prior to desired goals,
And it's better to have one line for all goals instead on one line per goal.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 15:09:17 +04:00
Kinsbursky Stanislav
9f7b6189b9 make: simplify OBJ on BLOBS dependence
Replace dances with "|" by simple dependence rule both for DEPS and OBJS.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 15:09:00 +04:00
Cyrill Gorcunov
424a4adb6f sockets, inet: Use general machnism for checkpoint/restore v2
Use fdtype_ops facility to c/r inet sockets.

v2:
 - Use BUG_ON if socket is attempted to be dumped
   several times

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:56:04 +04:00
Cyrill Gorcunov
c26b68dce8 sockets, unix: Use general machnism for checkpoint/restore v2
Use fdtype_ops facility to c/r unix sockets.

v2
 - BUG_ON added in dump_one_unix_fd if socket
   is already dumped since we never should dump
   same socket several times
 - The order of restore remains as it was before,
   the lookup is done via socket inode numbers

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:54:31 +04:00
Stanislav Kinsbursky
41195598cf parasite: remove excessive header deps from parasite.h and friends
The task is not complete - this is just a part of what have to be done. I.e.
looks like a lot of excessive deps can be fixed.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:50:18 +04:00
Kinsbursky Stanislav
df7dd55e10 make: Highlight Makefile.inc absence
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:48:18 +04:00
Victor Konyashkin
a72fd71e7f zdtm: Need increase buffer in msgque.c to avoid overflow
Need increase buffer in msgque.c to avoid overflow via memcpy,
because now mtext[20] less than ANOTHER_TEST_STRING "Yet another test sysv5 msg".

Signed-off-by: Victor Konyashkin <vkonyashkin@parallels.com>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-05-30 12:47:12 +04:00