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

1830 Commits

Author SHA1 Message Date
Andrey Vagin
458cb41f57 restore: disable repair mode in post_open()
A disabling repair mode drops SO_REUSEADDR.

We can set SO_REUSEADDR after disabling repair mode, but
a small race window exists in this case.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-27 23:16:50 +04:00
Pavel Emelyanov
c00038042d scm: Fix all fd flags drain in one chunk
Stupid misprint

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 20:28:46 +04:00
Pavel Emelyanov
f83ad9c46d dump: Log fd flags when dumping fds
For debugging

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 20:28:26 +04:00
Pavel Emelyanov
ed397e3a33 fds: Optimize fds draning (mem + cpu)
* Don't dumplicate array when sending to parasite
* Allocate necessary space in cr-dump for local fds/flags

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 19:59:07 +04:00
Pavel Emelyanov
ab806ebc03 scm: Check for cmsg not to be truncated when receiving fds
Otherwise we can get stuck waiting for more data in vain.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 19:40:10 +04:00
Pavel Emelyanov
5e95df84f9 parasite: Report negative value from parasite_execure
The value in eax is positive on error. Callers expect it to
be negative to report error.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 17:39:49 +04:00
Pavel Emelyanov
dffe544fe8 show: Show netdevice indices with %d
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 16:47:32 +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
Pavel Emelyanov
4dd8d1a98f show: Add pretty output for fdinfo
fd is shown in %d
flags are shown in %#o

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 16:30:37 +04:00
Stanislav Kinsbursky
6c9396f9bd protobuf: add generic support for "bytes" field
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 16:27:14 +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
Andrey Vagin
eb63547a9b zdtm.sh: logfd can be closed when crtools already detached (v2)
So try to check on extra descriptors a few times

v2: move save_fds in a loop

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 15:33:01 +04:00
Andrey Vagin
fab874bf2f zdtm: check external sockets
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 15:32:45 +04:00
Andrey Vagin
410345a9d1 zdtm: add ability to create an external tasks
It will be used for checking tcp connections, external unix sockets, etc

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 15:31:59 +04:00
Andrey Vagin
c238e99b29 zdtm: rework logging
* Delete internal buffer, all data are written immediately in a log file
* Add timestamp and pid in a message
* All processes write log messages in one file

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-21 15:31:23 +04:00
Pavel Emelyanov
3dd03b6e27 inet: Remove is_bound fn
It's now quite simple. It's better to open-code one.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 18:16:33 +04:00
Pavel Emelyanov
6fd87cd98b inet: Sanitize ii->ie mass dereference in inet sk restore
Just save the ii->ie on stack and do s/ii->ie/ie/ over the fn.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 18:14:02 +04:00
Pavel Emelyanov
a8e056bfc8 inet: Factor out sockaddr-s preparations
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 18:11:35 +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
a74605a78d sk-inet: restore option REUSEADDR (v2)
All sockets are created with SO_REUSEADDR, it's needed for restoring.
E.g.: A listen socket is created after a connected socket. Both of them
are binded to one port.

So SO_REUSEADDR should be restored, when all sockets on a port were created.

This code creates a structure for each port of one type of sockets
and accounts a number of sockets, which are not restored yet.

Sockets have a hook post_open(), in which it waits when all sockets for
a defined port would be created and then it will restore SO_REUSEADDR.

struct port contains a type (udp, tcp, etc) and a port number.
It doesn't contain family or addr, because it's extra loads of logic,
which doesn't bring a significant profits.

v2: fix according with comments from Pavel

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 17:50:08 +04:00
Andrey Vagin
61490ba985 files: add one more operation post_create
It will be used for restoring inet sockets. An inet socket is created with
the option REUSEADDR, because the restore logic requires this.
The origin value can be restored only when all sockets were restored.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 17:50:01 +04:00
Pavel Emelyanov
b719b93daa zdtm: Configure rings in packet socket test
Now we can at least look into images manually to check how
rings are dumped. Later we should write an auto test.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:33:00 +04:00
Pavel Emelyanov
2660b810d9 packet: Rings support
There's no way (currently) to check that the ring got restored.
Will do it once we implement mapping of a packet socket and
tcpdump app test.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:55 +04:00
Pavel Emelyanov
398bec28a9 zdtm: Test for packet fanout
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:34 +04:00
Pavel Emelyanov
4ee3345beb packet: Support fanout
This one may be present and may be not, thus it's optional in the image.
The C-binding we use report the field absense in the parsed stream via
the has_xxx field, but in the google docs it's stated, that

	"When a message is parsed, if it does not contain an optional
	 element, the corresponding field in the parsed object is set
	 to the default value for that field."

Thus, I also declare the default value for it to be not zero as 0 is
a valid fanout configuration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:27 +04:00
Pavel Emelyanov
12b826dce9 packet: Update diag header with fanout and rings
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:25 +04:00
Pavel Emelyanov
277f0f2cc5 parasite: Remove unneeded headers from parasite.c
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:32:19 +04:00
Cyrill Gorcunov
318c45d4c3 inotify: Add LOG_PREFIX
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:14:57 +04:00
Cyrill Gorcunov
deea62cd3c epoll: Add LOG_PREFIX
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:14:49 +04:00
Cyrill Gorcunov
f5fcea4201 eventfd: Add LOG_PREFIX
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:14:43 +04:00
Andrey Vagin
2d42c544ae dump: save all vdso pages (v2)
If a vdso page was not accessed before dump, it's not present
and now it doesn't save in a dump image.
The vdso area is restored as VMA_ANON, it isn't an actual vdso more,
so when a not-present vdso page is accessed, a zero page would be mapped.

For this reason we should save all vdso pages in a image.

v2: make code more clear

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-20 15:13:19 +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
c2bb8404fb packet: Fix collection logging
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-17 16:10:29 +04:00
Cyrill Gorcunov
19672e9cd1 files: Rename argument to sock
It's unclear why we've had two different names
for same argument. Moreover, "tsk" is definitely
misnamed feature.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-17 15:43:22 +04:00
Pavel Emelyanov
969ca6d9bf shmem: Get rid of static array of dumped shmem areas
These are used by single process, no need in keeping them in
such a strange way. Plus, turn this array into a hash table
for better search.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-17 00:20:58 +04:00
Pavel Emelyanov
9554b482c2 util: Introduce the shmalloc helper
This one allocates a memory, that will be shared (MAP_SHARED)
between all the subsequent children. This can now be just used
for fd resote, later it will be required at inet socket port
binding.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-16 20:41:34 +04:00
Pavel Emelyanov
69acf64f57 packet: Add support for mclists
The implementation is rather straightforward. One thing to note
is that non-single membership of each type is not supported. It
can be done, but I'm unaware of any software doing so.

Note: the pb show routine should be tuned to support showing bytes.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 21:04:49 +04:00
Pavel Emelyanov
712979a475 pb_show: Don't show all unknown fields as boolean
Broken by 92b6d86c.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 20:53:35 +04:00
Pavel Emelyanov
7e3463a855 packet: Add PACKET_COPY_THRESH into dump/restore
No test for it, sorry :( There's no easy way to check it works.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 19:41:58 +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
Andrey Vagin
da2ebabf86 zdtm.sh: check that the util "ip" containes our patches
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 17:50:19 +04:00
Pavel Emelyanov
fb57cd126e proto: Add comments describing why we need two IDs for unix and inet sockets
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 17:45:40 +04:00
Pavel Emelyanov
4ff60cd870 packet: Switch to use packet diag module
It's in net-next already and does provide all we currently
need (and more). Implementation is like for inet and unix
sockets.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 17:39:21 +04:00
Andrey Vagin
b50861327e zdtm: don't compile tests with --static
zdtm.sh copies all required libraries in a new root

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-15 15:06:49 +04:00
Pavel Emelyanov
29f6d62a8a pb: Init fsize to make compiler happy
protobuf.c: In function ‘pb_show_msg’:
protobuf.c:384:68: error: ‘fsize’ may be used uninitialized in this function [-Werror=uninitialized]
protobuf.c:247:9: note: ‘fsize’ was declared here

The warning about 'may be uninitialized' is false -- the BUG() is a never-returning function.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:52:21 +04:00
Stanislav Kinsbursky
96b62808ff protobuf: use pretty output for inet sockets
v4:
1) Only address specificator ('A') left

New custom specificators:

'A': output as socket address

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:50:48 +04:00
Stanislav Kinsbursky
694576723c protobuf: use pretty output for pstree
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-14 14:49:40 +04:00