2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 12:57:57 +00:00

122 Commits

Author SHA1 Message Date
Ruslan Kuprieiev
98b5541492 v2 rpc: change some "required" fields to "optional"
The most of fields are to be changed to "optional", because they are
optional in fact.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-16 15:21:13 +04:00
Pavel Emelyanov
54a6a79455 unix: Check service client for being null
For regular dumps this thing is not initialized.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-13 16:42:01 +04:00
Ruslan Kuprieiev
d74073a593 unix: Handle service socket on dump and restore
Service connection is actually an 'external' one from unix sockets engine POV,
but we don't want to dump it as such. Thus, we explicitly find one and dump it
as half-closed connection. On restore we push an artificial message into it
to report to the program that the dump-request was served, but the program is
restored.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-13 15:53:20 +04:00
Pavel Emelyanov
9a6bc0fdab unix: Add comments about icons and external sockets
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-09-10 12:24:11 +04:00
Ruslan Kuprieiev
14fff50719 v2 fix data loss when dumping semi-closed unix stream connection.
This patch fixes running into loop and data loss, when dumping
semi-closed unix stream connection.

patchv2 has error check, that was missed in v1.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-28 16:52:17 +04:00
Pavel Emelyanov
b18fb09eb9 show: Replace one-line show_foo calls with args array
We have generic do_pb_show() call and tons of show_foo
routines, that just call one with proper args. Compact
the code by putting the args into array and calling
the do_pb_show() in one place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-24 04:00:32 +04:00
Pavel Emelyanov
84737e2796 build: Generate most of the pb-desc automatically
These contain linkage between number, data type and routines
for pb messages we write/read to/from image files. Most of them
have simple number-type-routines mapping, so introduce a generating
script for that.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-23 21:47:31 +04:00
Pavel Emelyanov
60e6d38868 collect: Shorten common images collecting code
Now we have a set of cinfo-s, it's possible to collect all
this stuff in a plan for-loop.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 03:52:18 +04:00
Pavel Emelyanov
64e7d2435a collect: Reduce amount of args to collect_image call
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 03:27:06 +04:00
Pavel Emelyanov
9917c4fe34 rst: Compact file-descs collects a bit
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-21 01:06:58 +04:00
Pavel Emelyanov
72ec39f10c util: Rename pie's util-net.c into util.c
Will put more things there.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-29 12:43:30 +04:00
Cyrill Gorcunov
ec6b8e77e5 net: unix -- Print collected socket names
Quite convenient to know which exactly names are used.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-11 19:10:25 +04:00
Pavel Emelyanov
1148edc1a6 unix: Support semi-closed stream connection
Unix socket and have no peer, but be in established state.
Such types of sockets appear when one end of a connection
closes and leaves the peer in full-shutdown state.

Check this and handle properly on restore.

Reported-by: Florian Gross <Florian.S.Gross@web.de>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-07-02 02:28:43 +04:00
Pavel Emelyanov
d020ebb36d files: Compact the code by removing per-file dump helpers
Since *all* of them just call do_dump_gen_file with proper ops,
just call one directly. Compacts the code.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-06-14 00:11:08 +04:00
Pavel Emelyanov
add21b75c9 show: Remove options args from ->show callback
This thing is global, we can address one explicitly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-05-08 00:23:42 +04:00
Kir Kolyshkin
41c7ca8218 Fix typos in comments
This is less useful than fixing typos in output messages, but anyway.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:46 +04:00
Pavel Emelyanov
7bdba0f745 unix: Add _all_ peers into must-dump list
When dumping a unix socket we must make sure, that all connections
are dumped or -x option is used. Currently only peers with non-matching
ids are added into check. Fix this.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-02 23:27:45 +04:00
Andrey Vagin
d2b1d6f2aa socket: prevent dumping of sockets if they are not collected
The idea is simple. If the collection of given type of sockets failed,
crtools can't be sure, that it's able to dump such sockets correctly.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-28 18:23:18 +04:00
Cyrill Gorcunov
f95d509d2e sk-unix: Don't zap error returned
If error happened during queue read don't zap it.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-27 13:39:14 +04:00
Pavel Emelyanov
6b8c824fcc unix: More verbose output on ext unix socket dumping.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:38:25 +04:00
Pavel Emelyanov
f52d53c585 unix: Make more descriptive error logging for ext socket restore failure
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-03-26 19:32:53 +04:00
Andrey Vagin
f3cd454cd4 sk-unix: dump/restore a file permissions
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-30 03:28:01 +04:00
Andrey Vagin
0fc129a121 files: pass a file descriptor on an fdinfo image instead of cr_fdset
Currently fdinfo dumps for each task, so CR_FD_FDINFO is in cr_fdset.
A few tasks can share one fd table and the set of descriptors will be
dumped once and a image name will contain files_id instead of pid.
In this case CR_FD_FDINFO will go away from cr_fdset.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-11 14:47:09 +04:00
Alexander Kartashov
6f61488f21 x86: moved x86-specific files into the directory arch/x86.
* The following files goes into the directory arch/x86/include/asm unmodified:
  - include/atomic.h,
  - include/linkage.h,
  - include/memcpy_64.h,
  - include/types.h,
  - include/bitops.h,
  - pie/parasite-head-x86-64.S,
  - include/processor-flags.h,
  - include/syscall-x86-64.def.

* Changed include directives in the source files that include the headers
  listed above.

* Modified build scripts to reflect the source moves.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-01-09 17:02:47 +04:00
Andrey Vagin
08ffa65ed5 socket: don't fail if DIAG_SHUTDOWN is absent
A error message is printed.

We want to save ability to try crtools on non C/R kernel.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-29 17:43:32 +04:00
Andrey Vagin
1eb2212530 unix: restore file params and sockopts for all standalone sockets
We can have a situation, when a socket is bound, but isn't listen yet.

I can't find a situation, when we should not restore parameters.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-02 14:38:48 +04:00
Andrey Vagin
e5a8065713 unix: don't restore name for unix stream established sockets
A stream socket may be bound, but is not listen yet.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-02 14:37:45 +04:00
Andrey Vagin
434c107d7c unix: allow to dump closed sockets
Looks like it can be restored already.

#2408

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-02 14:37:33 +04:00
Pavel Emelyanov
a6a476ff23 skopts: Prepare for xmalloc-able entries on SkOptsEntry 2012-11-01 17:53:57 +03:00
Pavel Emelyanov
7d8ad0bc47 unix: Lost master socket opts restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 22:12:57 +04:00
Pavel Emelyanov
080282df7c unix: Simplify unix post-open callback
The fd we want to work on is the 2nd argument, no need
in calculating it out of file_desc.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 22:08:46 +04:00
Pavel Emelyanov
8471081244 unix: Add support for shutdown sockets
Get the info from kernel diag message (it should always be there)
and restore the shutdown at the very end.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-10-24 18:39:54 +04:00
Pavel Emelyanov
8fc6dbfadd files: Formalize fd restore priorities
There are places when we have to select which fd to ->open
and which to ->receive. To avoid deadlocks we sort them in
an ascending order on { pid, fd } pair.

Make this idea more formal by introducing an explicit function
doing this check and call it where appropriate (pipe.c master
selection is also simplified to fit new ... API).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-14 22:09:22 +04:00
Andrey Vagin
ca567e76c3 sk-unix: add a peer only if it's not in a list yet
I tried to fix that by:
commit bc2ac71c1abddbe76893c0dc1f0421311786070c
Author: Andrey Vagin <avagin@openvz.org>
Date:   Wed Sep 12 15:16:39 2012 +0400

    sk-unix: don't add a socket in a second time

but made a mistake and now a peer would be added only if it's in a list.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-12 17:49:36 +04:00
Andrey Vagin
bc2ac71c1a sk-unix: don't add a socket in a second time
A socket can be added in a list two times, if two other sockets
are connected to it.

This patch fixes a problem:
    Error (sk-unix.c:395): BUG at sk-unix.c:395

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-12 15:16:39 +04:00
Andrey Vagin
0c72ab18e0 sk-unix: add more information messages
* A message about external sockets is printed before any action.
* Add a message, when a peer is added in a list of sockets.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-12 15:16:21 +04:00
Andrey Vagin
582df5130b unix-sk: allocate unix_sk_info from a shared pool
Because unix_sk_info contains a futex, which may be used from a few
processes, we need to collect unix sockets into shared mem regions.

Reported-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 17:24:22 +04:00
Pavel Emelyanov
3158389d2d show: Show unix inodes and peers both in hex
Currently peer is %d, but this is wrong. It should be paired
with inode easily.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 16:37:27 +04:00
Stanislav Kinsbursky
768d88f228 protobuf: use pretty output for unix sockets
New custom specificator:

'S': output as string (unprintable characters replaced by dots)

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 16:27:07 +04:00
Pavel Emelyanov
7cb674109b unix: Remove conn-jobs
After previous rework (513dde00) they are no longer needed.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 17:51:33 +04:00
Andrey Vagin
351b23bb1a sk-unix: fix indents
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 17:50:23 +04:00
Andrey Vagin
513dde00d2 sk-unix: connect unix sockets in post_open
Move logic from run_unix_connections to post_open().

I don't fix indents in this patch for easy reviewing.
They are fixed in the next patch.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 17:50:16 +04:00
Andrey Vagin
5a0038a9eb sk-unix: fix connection to external sockets
Don't need to wait external sockets, they should exist.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 14:52:00 +04:00
Pavel Emelyanov
98759c76bb unix: Don't poll-wait on unix peer to be bound
Long time ago the conn jobs were implemented in a bad
manner -- they tried to connect to peer until it succeeds
sleeping in the middle.

Time to stop doing so and switch to proper futex-based
waiting for bound event.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-17 16:51:25 +04:00
Pavel Emelyanov
fb5a5671c8 sock: Do strict socket family checks when looking up collected socket
We hash socket with inode and family, but search only by inode. Well,
yes, family should match, since all sockets are in one sockfs in kernel,
but let's make sure _we_ did things right by checking the family as well.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 19:16:12 +04:00
Pavel Emelyanov
51133437c9 fd: Remove per-filetype make_gen_id abstraction
It doesn't makemuch sense in pulling this further. The generic genid generation seems to
be enough for eny file type.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:41:29 +04:00
Pavel Emelyanov
64149b40f2 code: A little but more checkpatch fixes over code
There are more in test/ (and checkpatch.pl crashes in the middle =),
but seem to be all.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 22:19:34 +04:00
Pavel Emelyanov
f1b41e0824 code: Replace 0x%x with %#x in messages
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-11 21:55:48 +04:00
Pavel Emelyanov
b91445701b img: Introduce generic routine for collecting image entries
On restore we typically read an image and put the entries into
some hash/list/whatever to work on them later. It's handy to have
a generic routine for doing so.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-09 13:16:46 +04:00
Pavel Emelyanov
b1b0a39a58 pb: Rewrite object reading to use pb-descs
The pb_read thing is no longer a macros. This will allow to
factor out objects collecting on restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-07 19:22:00 +04:00