2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00
Commit Graph

1856 Commits

Author SHA1 Message Date
Cyrill Gorcunov
5364592157 protobuf: Use GhostFileEntry instead of struct ghost_file_entry
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:17:51 +04:00
Cyrill Gorcunov
8041eac0e5 protobuf: Use RegFileEntry instead of reg_file_entry structure v3
This patch switches reg_file_entry structure with RegFileEntry
protobuf entry. Note that there a few nits remains

 - old fown_t structure doesn't scale well with FownEntry from
   RegFileEntry, so to not mess with rest of crtools code
   I've added a couple of opencoded copy operands, will clean
   this aspect up once rest of code is converted

 - the "show" procedure doesn't print fown for same reason

v2:
 - rename fown_t to fown_entry in .proto
v3:
 - don't print nil symbol on show

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:17:02 +04:00
Cyrill Gorcunov
a1fe3caf04 protobuf: Start switching our image entries to Google's protobuf
A short story -- there were a long conversation on which format should
be used to keep checkpointed data on disk image. We ended up in using
Google's Protocol Buffers (see https://developers.google.com/protocol-buffers/
for detailed description). Thus image entries should be convered to PB.

This patch converts fdinfo_entry to PB "message fdinfo_entry".

Build note: one should have protobuf and protobuf-c installed to be able
to build crtools.

 - http://code.google.com/p/protobuf/
 - http://code.google.com/p/protobuf-c/

Inspired-by: Pavel Emelianov <xemul@parallels.com>
Inspired-by: Kinsbursky Stanislav <skinsbursky@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:10:41 +04:00
Cyrill Gorcunov
c75b4b70fc protbuf: Add protobuf (PB) image entries read/write helpers v4
To not bloat util.h or image.h the protobuf.h introduced to handle all PB needs.

We represent our PB objects as pairs of records

  | 4 bytes for object packed size
  +---
  | X bytes -- object itself

v3:
 - Use plain read/write calls
 - Use local buffers for small objects

v4:
 - Add pb_pksize helper to calculate object
   size with header

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:00:18 +04:00
Pavel Emelyanov
e564ac6f04 parasite: Remove addr ards from drain fds cmd struct
After previous patch they are no longer required.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-16 10:24:10 +04:00
Andrey Vagin
a8607b121a cr-dump: create a transport socket only once
Before this patch a transport socket was created on-demand for each operation
requiring it. It will be problematic, when we start supporting net namespaces.
That said -- create a transport sockets and interconnect them early.

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-16 10:23:26 +04:00
Cyrill Gorcunov
f703f31990 sk-queue: Move struct sk_packet to C file
No need to keep it in header, sk_packet used solely in one C file.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-16 07:05:06 +04:00
Cyrill Gorcunov
a8c2bd0c5d sk-queue: Use sk_packet_entry as a reference
Need for PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-16 07:04:37 +04:00
Cyrill Gorcunov
65570d9559 sockets, inet: Use inet_sk_entry as a reference in inet_sk_info
For PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-16 07:03:59 +04:00
Cyrill Gorcunov
8e195849a3 sk-queue: Use int values in getsockopt
The kernel threats them as interger values so
we should declare them this way. Moreover, explicitly
clean them up to eliminate side effects.

Initially I hit a problem where high bits of long "size"
variable was containing some crap from stack and in result
I've got errors like

 | Error (sk-queue.c:102): dump_sk_queue: Can't allocate 171798904800 bytes
 | Error (cr-dump.c:1289): Dump files (pid: 2505) failed with -1

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-16 06:59:04 +04:00
Konstantin Khlebnikov
c256706a09 zdtm: /sys/kernel/debug not present in container
debugfs isn't virtualized and never will be

jira #PCLIN-31059

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Acked-by: Andrey Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-16 06:57:19 +04:00
Pavel Emelyanov
a89b40aa66 skqueue: Show should use pr_msg
Otherwise the show result depends on the loglevel :\

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-12 11:22:31 +04:00
Pavel Emelyanov
e21885b0de regfile: Fix regular file open and lseek on restore
1. Seeking should be done for real files only , for fifos using the
   same code -- shouldn't. Thus -- move the lseek to proper place;
2. It's nice to print error on file open error;
3. It's nice to handle lseek error.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-12 08:37:39 +04:00
Cyrill Gorcunov
29e8c85627 sockets, unix: Use unix_sk_entry as a reference in unix_sk_info
For PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-13 11:57:49 +04:00
Cyrill Gorcunov
6c2807e512 pipes: Use pipe_entry as a reference in pipe_info
Need it for PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-13 11:56:41 +04:00
Pavel Emelyanov
237ef3c809 pipe: Rework pipe data restore to use vmsplice
This serves two things -- kills annoying data offset management
which makes protobuf switch too ugly. And removes the need to
seek the pipe data image, which in turn is the prerequisity for
streaming migration.

Memory usage is still optimal, since we still use splice on dump
path and on restore stage we F_GIFT pipe buffers to the kernel.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-12 06:57:20 +04:00
Pavel Emelyanov
c69d18eada util: More traditional xfree macro
Using do { } while (0) for statemets macro like this is a good practice.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 14:45:08 +04:00
Pavel Emelyanov
ab59e7d3a5 pipes: Plug memory leak on pipd data image EOF
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 14:44:00 +04:00
Cyrill Gorcunov
906f08133b pipes: Use pde as a reference in pipe_data_rst
Need it for PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 14:41:03 +04:00
Pavel Emelyanov
12a0462f7e util: Shorten array for anon_inode link checking
Strictly speaking the fd link can point to PATH_MAX string, but for the sake of
is_anonfd_link 32 bytes is enough -- even if the target string is longer it will not
match the required anon_inode:xxx string.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 12:58:46 +04:00
Pavel Emelyanov
f965ead8b8 pipe: Shorten array for self link path
To open /proc/self/fd/%d PATH_MAX array is too long :) We can use shorter.
Plus fix the snprintf size argument.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 12:57:19 +04:00
Pavel Emelyanov
d271850694 pipe: Add helper for getting pipe_id from fdparms
Just to explicitly state that a pipe ID is its inode number.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 11:57:28 +04:00
Pavel Emelyanov
76638fd5c3 check: Add check for inotify is shown proerly in fdinfo
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 10:26:46 +04:00
Pavel Emelyanov
a80e9e2eab check: Add check for epoll is shown proerly in fdinfo
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 09:55:10 +04:00
Pavel Emelyanov
7baadd7f1b check: Fix set_mm_exe_file prctl retcode
Now it is EBADF for bogus descriptor we pass

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 09:46:44 +04:00
Pavel Emelyanov
888bc286df check: Add check for evetfd is shown proerly in fdinfo
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 09:45:32 +04:00
Pavel Emelyanov
feb6624ddf inotify: Wire into and use Generic fdinfo parsing engine
With this the code looks clearer and finally a ground for "check" code is prepared.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 09:35:36 +04:00
Pavel Emelyanov
0b9d1d970f event*: Move proc parsing stuff to proc_parse
And prepare it for inotify (oh my...)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-11 09:22:38 +04:00
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