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

1830 Commits

Author SHA1 Message Date
Kinsbursky Stanislav
0456049579 protobuf: generic show function introduced
This function can be used for any protobuf message which contains required,
repeated and even nested messages fields.

The functions doesn't support yet:
1) Optional fields (skipped)
2) Fields types: PROTOBUF_C_TYPE_FLOAT, PROTOBUF_C_TYPE_DOUBLE,
PROTOBUF_C_TYPE_BOOL, PROTOBUF_C_TYPE_ENUM, PROTOBUF_C_TYPE_BYTES.
These are show as unknown objects.

IOW, it supports only existent proto files.

Inspired-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 08:25:03 +04:00
Cyrill Gorcunov
808b8f2f06 protobuf: Convert mm_entry to PB format
Because the MmEntry has a "repeated" field, we
copy aux vector explicitly and reserve space for
it in task args.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-19 07:25:05 +04:00
Cyrill Gorcunov
a7691bcbe2 protobuf: Convert itimer_entry to PB format
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-18 16:27:01 +04:00
Cyrill Gorcunov
6b9d3affc9 protobuf: Convert sa_entry to PB format
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-18 16:25:06 +04:00
Pavel Emelyanov
b75d66e7df itimers: Don't write itimer_entry from parasite
Same as with previous patch -- we have to pull image-independent entry out of the victim
task to be able to use protobuf library for encoding.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-18 07:23:05 +04:00
Pavel Emelyanov
0f9abfc2dc sigact: Don't write sa_entry from parasite code
Pull the array of rt_sigact_t-s to the crtools instead and fill+write sa_entries there.
This is required to switch to protobuf, since we cannot use pb lib code in parasite for
encoding sa_entries.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-15 10:18:35 +04:00
Cyrill Gorcunov
7861d32de0 protobuf: Convert struct pipe_data_entry to PB engine
Note, at moment we don't use "data" from proto declaration,
it's reserved to implement later (simply because it's easier
to use current code for a while).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 14:50:23 +04:00
Pavel Emelyanov
786012e891 mnt: Fix mountinfo collecting issues
1. Mountinfo should be collected after we have forked into new namespace (strictly
   speaking this is so)
2. When restoring a mnt ns we can reuse the collected mntinfos rather than reading
   them again.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-15 08:43:37 +04:00
Cyrill Gorcunov
ca08ad53a6 protobuf: Convert mnt_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 14:23:37 +04:00
Pavel Emelyanov
5fd0ace2c8 protobuf: Check pack/unpack/getsize function types
We pass them as generic (*)() pointers into pb_read/pb_write so typechecking is required

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 08:38:20 +04:00
Cyrill Gorcunov
4d49125ff0 protobuf: Convert sk_packet_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 08:03:43 +04:00
Cyrill Gorcunov
7818863ad0 protobuf: Convert tcp_stream_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:52:44 +04:00
Cyrill Gorcunov
73215d0aad eventpoll: Cleanup fown_t usage
Switch to pb_ helpers to shrink code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:30:09 +04:00
Cyrill Gorcunov
baa30914b5 protobuf: Convert pipe_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:29:57 +04:00
Cyrill Gorcunov
ccb254c1f0 protobuf: Convert pstree_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:29:36 +04:00
Cyrill Gorcunov
b02158c14c protobuf: Convert struct fs_entry to PB engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:28:38 +04:00
Cyrill Gorcunov
28638b611c protobuf: Convert inotify data to protobuf engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:25:42 +04:00
Cyrill Gorcunov
fa923ee14e protobuf: Convert eventpoll data to protobuf engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:25:40 +04:00
Cyrill Gorcunov
1d484b713a files-reg: Use pb_ helpers to shrink the code
Use recently introduced pb_ helpers to shrink the code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:25:38 +04:00
Cyrill Gorcunov
ca21674573 protobuf: Convert eventfd data to protobuf engine
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:24:54 +04:00
Cyrill Gorcunov
1abf969d8c show: Add pb_show_fown_cont helper
Need for PB transition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:24:52 +04:00
Cyrill Gorcunov
7c44757683 files: Add pb_ helpers
To not spread opencoded copying of PB entries and image structures
we add a few pb_ helpers to be used until PB code completely merged.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:24:51 +04:00
Cyrill Gorcunov
98acfbec28 protobuf: Use RemapFilePathEntry instead of struct remap_file_path_entry
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:18:58 +04:00
Cyrill Gorcunov
dbf29ef92a protobuf: Use FifoEntry instead of struct fifo_entry
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-07-17 07:18:40 +04:00
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