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

1856 Commits

Author SHA1 Message Date
Cyrill Gorcunov
05466cc38a restorer: Pass current log level to the arguments
Will need it to honor current log level in restorer.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-03 14:44:09 +04:00
Cyrill Gorcunov
3a00f4cdc8 log: Add log_get_loglevel() helper
Will need it to fetch log level for restorer code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-03 14:44:01 +04:00
Cyrill Gorcunov
ff7d7455e2 Introduce log-levels.h
To teach restorer code the log levels we
need a separate file for their definition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-03 14:43:51 +04:00
Cyrill Gorcunov
3234308d62 make: Fix build bug introduced in 726a1180
In 726a1180 we made protobuf library to depend
on *.ch which is good thing but a bit incomplete.
We need a rule to generate headers if they are
missed.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-03 13:26:14 +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
Andrey Vagin
85b5a9243d protobuf: add ability to collect objects in a shared memory (v2)
v2: s/shcollect_image/collect_image_sh/

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 17:23:50 +04:00
Andrey Vagin
67b6748f68 util: add ability to release a last piece from a shared pool (v2)
v2: s/shfree/shfree_last

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 17:23:27 +04:00
Andrey Vagin
ae70bc0ad6 net: add ability to set names for outside links of veth devices
When restoring a container crtools create veth pair inside it and then
pushed one end to the namespaces crtools live in (outside). To facilitate
the subsequent management of the otter end of the veth pair this option
is added -- one can specifu a name by which the respective end would be
visible. E.g.: --veth-pair eth0=veth101.0

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 01:07:32 +04:00
Cyrill Gorcunov
bf94ff3a26 check: Don't forget to init mountns
Otherwise fstatat fails as

> > $ ./crtools check
> > Error (sk-unix.c: 283): Can't stat socket 12547 (./var/run/sdp): Bad file descriptor

Reported-by: "Muralidhar, Rajeev D" <rajeev.d.muralidhar@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 01:04:14 +04:00
Andrey Vagin
d8af1d72fa zdtm: don't use dprintf, because it's not thread safe
pthread00 hangs if dprintf is used, and works well if fprintf is used.

One more mention of this bug is here:
http://sourceware.org/bugzilla/show_bug.cgi?id=12847

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 01:03:10 +04:00
Andrey Vagin
9ec01ff307 log: don't create a log file in a current directory
We can set a directory for log and image files.
crtools sets it as a current directory and then creates all files in it.
It works before we don't decide to change a mount name space.

I suggest to open a log dir and create files for help openat.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 01:02:30 +04:00
Andrey Vagin
855c20ac1c zdtm: don't used --log-pid by default
I added this options and I found, that it was a bad idea.
Currently crtools prints PID for each message, so
--log-pid can help if an error in the restorer code.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 01:01:40 +04:00
Andrey Vagin
234b5883b9 zdtm: show errors if a test failed
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 01:00:26 +04:00
Andrey Vagin
292d0adfdd zdtm: add forgotten tests
This tests passed already, so add them in the regular list.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 01:00:07 +04:00
Cyrill Gorcunov
726a1180aa make: Make protobuf target to depend on *.ch
Our general source code depends on headers
generated during protobuf library building
but if library is already built and *.ch
files are removed we might hit a problem
where dep files can't be generated.

Thus add explicit rule pointing out that
library depends on generated *.ch files.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 00:59:25 +04:00
Cyrill Gorcunov
40688d1945 make: Use PROTO_ prefix for protobuf targets
It's easier to handle things if we know that names
in makefiles are never intersected.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 00:59:05 +04:00
Cyrill Gorcunov
d88eebc9e0 make: Move common definitions to Makefile.inc
To eliminate code duplication.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 00:58:37 +04:00
Cyrill Gorcunov
de78c6db55 make: Don't forget to clean protobuf generated file on rebuild
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-09-02 00:58:02 +04:00
Andrey Vagin
c5f6a082b9 zdtm: use a current stack for preccesses created by clone()
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-28 23:19:45 +04:00
Andrey Vagin
d34b9004a7 restore: use a currect stack for new processes (v3)
Why do we need a new stack? We already have one and it can be used.

We need to step a bit for executing a glibc clone()

v2: Don't lose a page from a child's stack
v3: Remove the defined constant STACK_SIZE

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-28 23:19:28 +04:00
Cyrill Gorcunov
d2fab85055 files: Rename variables in collect_fd
Variables `l' and `le' are short and named
too similar which makes them hard to distinguish.

Thus rename `l' to `le' (list entry) and `le' to
`new_le'. This makes them easy to recognize.

Also add braces around list_for_each_entry.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-27 23:24:06 +04:00
Cyrill Gorcunov
874fce48ec net: Use BUG() instead of BUG_ON(1)
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-27 23:22:56 +04:00
Cyrill Gorcunov
f473f4f24d mount: Use BUG() instead of BUG_ON(1)
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-27 23:22:41 +04:00
Cyrill Gorcunov
b3a050e1f1 files: Use BUG() instead of BUG_ON(1)
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-27 23:22:25 +04:00
Cyrill Gorcunov
b6b9bb0cd2 files: Drop unused FDINFO_POOL_SIZE
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-27 23:22:07 +04:00
Cyrill Gorcunov
4ececa09ba files: Drop unused self_exe_fd declaration
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-08-27 23:21:44 +04:00
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