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

4661 Commits

Author SHA1 Message Date
Cyrill Gorcunov
74a2cce189 page-pipe: Don't increase the page_pipe::nr_pipes if we reuse pipes
The page-pipe buffers may be reused once queued pages are
dumped, but we happen to increase page_pipe::nr_pipes
all the timer, regardless the fact where page buffer
came from.

In worst scenario this may lead to incorrect -EAGAIN returned
from page_pipe_grow forcing calling code to create new
pipes. This is not critical but should be fixed.

In other words page_pipe::nr_pipes must track _really_
created pipes.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-05-07 21:01:35 +04:00
Pavel Emelyanov
54a996b0f3 criu: Version 1.3-rc1
We have made big step towards C/R of LXC containers -- made support
for nested mount namespaces and addressed the re-attach issue. Also
we have AArch64 support merged.

Some work is still to be done, but it's good time to show what we
have so far, thus -- the 1.3-rc1.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
v1.3-rc1
2014-04-25 15:40:17 +04:00
Christopher Covington
5d74f55d80 Don't say /proc in macro errors
It's possible that a procfs mounted somewhere other than /proc
is in use.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-25 13:25:13 +04:00
Cyrill Gorcunov
0c89d779f9 log: Include inttypes.h for PRI helpers
https://bugzilla.openvz.org/show_bug.cgi?id=2949

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-25 13:23:55 +04:00
Andrey Vagin
74c0e9e201 check: skip mnt_id support check for mainstream kernels (v2)
v2: s/tun/mnt_id
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-25 13:22:43 +04:00
Andrey Vagin
08960eb1fb zdtm: check mnt_id in /proc/PID/fdinfo/X
Nested mount namespaces should be checked only if fdinfo contains mnt_id

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-24 11:55:40 +04:00
Pavel Emelyanov
d4e4e57744 mnt: Get ns temp root path once when collecting data from image
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 17:40:39 +04:00
Pavel Emelyanov
5975c94e3c zdtm: Add testing of irmap cache generation
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 17:24:19 +04:00
Andrey Vagin
a20011aca6 ns: initialize nsid in rst_add_ns_id
Execute zdtm/live/static/pipe00
./pipe00 --pidfile=pipe00.pid --outfile=pipe00.out
Dump 3158
Restore
test/zdtm.sh: line 472:  3173 Segmentation fault      (core dumped) setsid  restore --file-locks --tcp-established -x -D  -o

Reported-by: Jenkins Criuovich
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 14:46:19 +04:00
Pavel Emelyanov
8d5822d9cb mnt: Factor out mntns nsid creation on restore
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 13:22:12 +04:00
Pavel Emelyanov
aca33ac402 mnt: Add comment why we need criu's mntns mounts for dump
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 13:10:21 +04:00
Pavel Emelyanov
f22591c99a files: Check for for mount to exist only once
The nsid lookup will search for mount in case mnt_id
is given. No need to do it twice (the 2nd time for
sanity check).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 03:01:21 +04:00
Pavel Emelyanov
74357818f8 unix: Get ns root fd only once.
This makes mntns_get_root_fd usage more natural.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 02:51:11 +04:00
Pavel Emelyanov
8ef1d378bf mnt: Add comments on tricky places
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 02:47:42 +04:00
Pavel Emelyanov
3d11c6c0ed mnt: Sanitize prepare_mnt_ns nsids loop
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 02:35:04 +04:00
Pavel Emelyanov
68e2841a9b mnt: Turn mntns_get_root_fd into accepting mnt ns_id
The only exception (for now) is the irmap -- it should
operate on ns as well.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 02:31:16 +04:00
Pavel Emelyanov
1c4f8fdcc2 remap: Keep nsid on remap rollback, not the ns' pid
This is more logical -- we should remap file in namespace,
not in pid. Also this would help to clean the code further.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 02:23:46 +04:00
Pavel Emelyanov
d5e6a51bfe Revert "mnt: Merge two calls to collect_mntinfo on early restore"
This reverts commit f55a0b912c2bb105513b5f6e08a024958968ab9a.

The collected mounts list a) points to nsid and b) should be
put on nsid's mntinfo_tree. Thus is _should_ be done by separate
calls.
2014-04-23 01:49:34 +04:00
Pavel Emelyanov
1435617c40 mnt: Rename _collect_root into _get_root_fd
Nowadays this routine is mainly used for getting an
fd, rather than keeping one for future reference.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-23 01:38:58 +04:00
Andrey Vagin
20003300d8 mount: remove extra calls of mntns_collect_root()
Now mntns_collect_root() should be called each time when we need to get
a root of a specified namespace and we don't need to call it for
initializing the global variable.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:49:43 +04:00
Pavel Emelyanov
4ec63d53e1 rst: Don't lookup ns if current mntns is the same as root's one
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:48 +04:00
Pavel Emelyanov
79f3e90856 rst: Less arguments to restore_task_mnt_ns
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:46 +04:00
Pavel Emelyanov
8472345d0a rst: Don't forget to close nsfd after setns
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:44 +04:00
Pavel Emelyanov
f55a0b912c mnt: Merge two calls to collect_mntinfo on early restore
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:43 +04:00
Pavel Emelyanov
8550f52017 mnt: Move local mntns collecting on restore into prepare_mnt_ns
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:43 +04:00
Pavel Emelyanov
05c02ddcf9 mnt: Move nsmask checking into prepare_mnt_ns
Helper for simpler next patch.

Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:42 +04:00
Pavel Emelyanov
908915889d mnt: Sanitize collect mntinfo error path
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:41 +04:00
Pavel Emelyanov
f818065e48 mnt: Mark fini_mnt_ns as void arg
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:41 +04:00
Pavel Emelyanov
02f7c5c624 mnt: Helper for getting mntns root path
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:40 +04:00
Pavel Emelyanov
169dada873 mnt: Mark create_mnt_roots as void arg
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:39 +04:00
Pavel Emelyanov
f4b7a6fedd mnt: Mark rst_collect_local_mntns as void
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:38 +04:00
Pavel Emelyanov
b08af3a90d mnt: Merge mnt nss dumping and collecting code
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:36 +04:00
Pavel Emelyanov
33b7ec5034 mnt: Move collect and list of pms out of ns dumping routine
This is a helper for the next patch.

Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:35 +04:00
Pavel Emelyanov
88eef43e41 mnt: Mark dump_mnt_ns as static
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:33 +04:00
Pavel Emelyanov
f60109f272 mnt: Check for ns being mnt before dumping
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:26 +04:00
Pavel Emelyanov
d49fd40e55 mnt: Sanitize the code of reading mnt images routine
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:24 +04:00
Pavel Emelyanov
4ffa79695d mnt: Remove unneeded argument from prepare_mnt_ns
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:23 +04:00
Pavel Emelyanov
bc312d3229 mnt: Fix void argument for reading mnt images helper
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:22 +04:00
Pavel Emelyanov
dd43b3c529 mnt: Helper for adding new set of mountpoints into global list
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:21 +04:00
Pavel Emelyanov
1009985e30 collect: Check for ns being mnt before collecting
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 23:48:20 +04:00
Cyrill Gorcunov
443adb5a45 kcmp: Fix ret code comparison
In the early draft of kcmp syscall it has been returning
[-1|0|1] values but finally [0|1|2] were merged into the
kernel, but I forgot to update the criu code. The good
thing is that because we're using rbtree the kcmp results
are still sorted and tree is balanced but sometime we may
take a wrong branch generating new ID even if the object
is present in the tree which eventually may lead to dump
faulure.

Reported-by: Deyan Doychev <deyan@1h.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-22 12:51:15 +04:00
Andrey Vagin
85569e8dd4 mount: prevent dumping nested mount namespace without mnt_id in fdinfo
When we don't know mnt_id, we don't know to which namespace a file
belongs.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:27 +04:00
Andrey Vagin
8620912d22 check: check the mnt_id field in fdinfo
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:26 +04:00
Andrey Vagin
a3ea8102ea zdtm: check opened files in a second mntns
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:25 +04:00
Andrey Vagin
37924895b5 mount: don't open the same root twise
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:24 +04:00
Andrey Vagin
2f4be997b6 mount: use per-namespace mntinfo_tree (v2)
This patch removes the global mntinfo_tree and collect_mount_info where
it was constructed. The mntinfo list is filled from dump_mnt_ns,
rst_collect_local_mntns, collect_mnt_namespaces and read_mnt_ns_img.

A mountinfo entry contains a reference on a proper ns_id entry, so
we cau use mnt_id to look up a proper mount namespace.

v2: remove trash after rebasing.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:19 +04:00
Andrey Vagin
03c69251ab restore: set buildinfo_tree for each mount namespace
On restore all namespaces are restored as one tree and
a pointer on the root of this tree will be set on each namespace.

Below you can find a call trace, where it's used:

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:18 +04:00
Andrey Vagin
380c0d67fe mount: give a list of mounts into validate_mounts
It's a typo fix.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:14 +04:00
Andrey Vagin
fb3ce0fbeb mount: prepare to work without mnt_id
Kernels before 3.15 doesn't show mnt_id and mnt_id isn't saved in
images, if mntns isn't dumped.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:10 +04:00
Andrey Vagin
b6d3314c54 check: collect mounts of the current mntns
They are used for collecting unix sockets

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-04-21 22:40:04 +04:00