Commit graph

5561 commits

Author SHA1 Message Date
Andrew Vagin
d2762ddf77 mnt: Use ns_mountpoint to open a mount point
open_mountpoint helper is called when mount namespace are
already restored so we have to use local paths.

This is a continuation to patch a082f27b -- we keep mount
point id in fsnotify, thus we should use the namespace's
path for open.

https://jira.sw.ru/browse/PSBM-39957

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-22 17:13:21 +04:00
Andrew Vagin
00acf5228f fsnotify: save mnt_id with path
Otherwise it's impossible to understand from which namespace
this path should be opened.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-22 17:13:15 +04:00
Andrew Vagin
dfef4e05d5 mnt: Fix slave mounts order estimation in can_mount_now
For slave mount we need to make sure that all childrent
mountpoints of the master peer is mounted before we can
proceed otherwise there gonna be duplicated mountpoints
after the restore.

https://jira.sw.ru/browse/PSBM-39957

Signed-off-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-22 17:13:08 +04:00
Cyrill Gorcunov
ad56fb3c81 mnt: Don't treat ns roots as special when restoring
Namespace roots might be slave ones from another
namespace roots, so we should not treat them as
"always ready" for mounting but rely on general
logic in can_mount_now which tests slaves relations.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-22 17:13:02 +04:00
Andrey Vagin
c3e88444d8 mount: use absolute paths for pivot_root
When we initialize a sub-mount namespace, we need to use absolute paths.
For example we change cwd in prep_unix_sk_cwd()

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-22 17:12:57 +04:00
Pavel Emelyanov
f1e8a9ce6b criu: Version 1.7
We have quite a lot of new stuff this time. More flexibility
in cgroup management code (and this story far from being over)
in the library and in the crit command line, preparations to
x66 32bit, that also helped the PPC port, freezer cgroup
filannly found its place in the code. We also had our first
CVE-s found :) and a LOT of bugs fixed.

So the plan for the 1.8 is: cgroups, secured containers and
bugfixes. x86 32bit is tempting too.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-07 12:26:32 +03:00
Cyrill Gorcunov
a85b54ab54 zdtm: Fix building for @_BSD_SOURCE redefinition
Travis testing engine complained about @_BSD_SOURCE
which is not the case on my build environment.
Anyway lets do a safe thing -- conditional definition.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 22:01:00 +03:00
Cyrill Gorcunov
eb02c8c1fd test: file_locks -- Use device from mountinfo for BTRFS
BTRFS uses own device numbering scheme so lets do a trick
close one to what we have in CRIU itself -- mangle
device to match mountinfo output.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 19:36:27 +03:00
Cyrill Gorcunov
954ba48d1d zdtm: Add filesystem specific helpers
In particular we have to find out if we're
running on btrfs filesystem for proper device
number mangling.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@odin.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 19:35:59 +03:00
Andrey Vagin
ec31527be1 jenkins: include criu-lib.sh and call prep()
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 18:46:25 +03:00
Andrey Vagin
50d4d07367 netlink: increase the receive buffer size
Currently the buffer size is 4096. It always works because
we use hosts where PAGE_SIZE is 4096. PowerPC64 has a bigger PAGE_SIZE.

Here is a comment from the kernel code.
/*
 *      skb should fit one page. This choice is good for headerless malloc.
 *      But we should limit to 8K so that userspace does not have to
 *      use enormous buffer sizes on recvmsg() calls just to avoid
 *      MSG_TRUNC when PAGE_SIZE is very large.
 */

We set the buffer size to 16384, because it's the max length of recvmsg()
for this case. We will need less iterations to collect all data, so
the perfomance should be better.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Cc: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 18:26:51 +03:00
Cyrill Gorcunov
675a84fbc9 mount: Rename get_widest_peer to find_widest_shared
It lookups over shared entries and finds widest.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 18:23:41 +03:00
Cyrill Gorcunov
f7d550323b mount: Fix comment style
We don't use C99 comments.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 18:20:52 +03:00
Andrey Vagin
2971fb187f jenkins: add a script to execute tests on PowerPC
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 18:18:43 +03:00
Andrew Vagin
f20dfbdd95 zdtm: skip linux-vdso64.so when a new root is contructed
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 18:18:12 +03:00
Andrew Vagin
edd552619e zdtm: fix compilation on PowerPC
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-04 18:18:11 +03:00
Cyrill Gorcunov
eb6dcc4070 mount: Fix restore deleted bindmounts for regfiles
- make sure it doesn't exist using O_EXCL
 - don't forget to close it

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-02 18:51:01 +03:00
Pavel Emelyanov
92fcb8691b Fix compilation after previous commit
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-02 15:53:31 +03:00
Hui Kang
19dbe25918 Skip root cgroup directories when restoring with manage-cgroup=full
Signed-off-by: Hui Kang <hkang.sunysb@gmail.com>
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-02 15:40:59 +03:00
Cyrill Gorcunov
911bb68283 test: mntns_deleted -- Add bindmount for regular files
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-02 15:33:58 +03:00
Cyrill Gorcunov
d27f5391d5 mount: Handle deleted bindmounts for regular files
1) Deleted bindmount for files should be restored
   by creating temp file. The kernel doesn't permit
   to mix bindmount in terms of file/dir relationship:
   either both source and target should be files or
   directories.

   Thus we can call stat on the target and figure out
   what kind of source we had.

2) Even for deleted entries better to use permissions
   from the target's stat call, this makes result close
   to how would it look if program hadn't been checkpointed.

Reported-by: Andrey Wagin <avagin@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-02 15:33:46 +03:00
Andrew Vagin
bee835ebeb zdtm/file_locks01: fix testing devices
Reported-by: Mr Jenkins
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-02 13:18:28 +03:00
Andrey Vagin
4b0c0c5828 zdtm/file_locks03: don't use pipe for synchronization
Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-01 15:20:36 +03:00
Andrew Vagin
2ce6a6a2af file_locks02: don't use pipe for synchronization
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-01 13:14:06 +03:00
Laurent Dufour
f2bc172f67 ppc64: fixing build issue
The commit 69d008d567 ("Use run-time page_size() for mremap")
introduces the use of dynamic page size in rst-malloc.c.

The commit also add the include of unistd.h in
arch/aarch64/include/asm/page.h to allow the build to succeed on this
architecture.  Since ppc64 is also using the same way to deal with page
size, the same include is required in arch/ppc64/include/asm/page.h

Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
CC: Christopher Covington <cov@codeaurora.org>
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-01 12:30:56 +03:00
Andrey Vagin
83f79c7e8c ptrace: print error code for PTRACE_DETACH
*** CID 139494:  Error handling issues  (CHECKED_RETURN)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-01 12:26:03 +03:00
Andrey Vagin
35ec944304 file: reserve one byte in a string buffer for the null byte
*** CID 139492:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-01 12:25:39 +03:00
Andrey Vagin
f62fd61709 seize: fix used after free case
*** CID 139496:  Memory - illegal accesses  (USE_AFTER_FREE)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-09-01 12:25:33 +03:00
Andrew Vagin
8189eda7b9 zdtm/file_locks1: compare devices in addition to inodes
You can see two equal inode numbers with differen devices and
it was a reason why the test failed.

4: C: 12491/12495/12496
4: c: 1: POSIX  ADVISORY  WRITE 0 fc:03:12468 0 EOF
4: c: 2: POSIX  ADVISORY  READ  0 fc:03:12421 0 EOF
4: c: 3: POSIX  ADVISORY  WRITE 0 00:14:16285 0 EOF
4: c: 4: FLOCK  MSNFS     READ  4 fc:03:12496 0 EOF
4: c: 5: FLOCK  ADVISORY  WRITE 4 fc:03:12495 0 EOF
4: c: 6: FLOCK  ADVISORY  READ  4 fc:03:12491 0 EOF
4: c: 7: POSIX  ADVISORY  WRITE 0 00:14:16280 0 EOF
4: c: 8: POSIX  ADVISORY  WRITE 0 00:14:12677 0 EOF
4: c: 9: FLOCK  ADVISORY  WRITE 0 00:14:12520 0 EOF
4: c: 10: FLOCK  ADVISORY  WRITE 0 00:14:12495 0 EOF
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-25 16:01:40 +03:00
Andrey Vagin
439de67a4b test/rpc: don't use the shell_job option
It isn't required.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-25 16:00:37 +03:00
Andrey Vagin
5075f278f6 test/rpc: don't call criu_resp__free_unpacked for NULL
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-25 16:00:29 +03:00
Andrey Vagin
bba4000c40 test/rpc: import the errno module
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-25 16:00:20 +03:00
Andrey Vagin
31475ffa6d test/rpc: track changes of the criu binary
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-25 16:00:13 +03:00
Andrey Vagin
f837310e13 zdtm/fdt_shared: wait until children finish the preparation stage
Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-25 15:59:59 +03:00
Cyrill Gorcunov
e6e56a6294 test: mount -- Add simple testcase for deleted bindmounts
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:26:25 +03:00
Cyrill Gorcunov
80ef8fd2fb mount: Handle deleted bindmounts
To handle deleted bindmounts we simply create
the former directory bindmount lived at, mount
the target and remove the directory back.

For this sake we add @deleted entry into the image.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:26:17 +03:00
Cyrill Gorcunov
60f6ec7dd6 files-reg: Rework strip_deleted helper
Make it handle both postfixes and return
non-zero code if stipping happened.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:26:01 +03:00
Cyrill Gorcunov
4f8f97e0bd mount: mount_info -- Drop unused @is_file
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:25:14 +03:00
Andrey Vagin
311e927b5c test: execute other tests in a new session
The main reason is to execute tests without a control termnal and avoid
a case when tests try to use the --shell-job options.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:13:47 +03:00
Andrey Vagin
ad80227a37 test/mem-snap: wait util a zdtm test isn't stopped
before checking results.

Reported-by: Mr Jenkins
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-21 21:13:43 +03:00
Tycho Andersen
0ac4c13e60 fix typo
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-18 18:17:58 +03:00
Cyrill Gorcunov
40ed330c88 kcmp: Stop showing ids tree
Useless, at least in the form present
now it's unreadable anyway. So stop
welling out the logs.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-18 18:17:31 +03:00
Cyrill Gorcunov
db70a415ed mount: propagate_mount -- Add braces
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-18 18:15:50 +03:00
Saied Kazemi
91a82fde71 Add OverlayFS support to docker_cr.sh
The main purpose of this patch is to add OverlayFS support to docker_cr.sh
for external checkpoint and restore.  It also does a bit of cleaning
and minor enhancements.

Signed-off-by: Saied Kazemi <saied@google.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-18 18:14:32 +03:00
Cyrill Gorcunov
5c18267ddf proc-parse: Fix line merging
Seems was a typo.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:18:19 +03:00
Cyrill Gorcunov
8c9e15560a mount: Shrink lookup_nsid_by_mnt_id
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:18:09 +03:00
Cyrill Gorcunov
69657701c4 mount: overlayfs -- Shift code left in __lookup_overlayfs
Also use is_root_mount() helper instead of opencoded
strcmp("./", m->mountpoint) and -Ex error codes in
ERR_PTR.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:17:54 +03:00
Cyrill Gorcunov
8603ae77f8 mount: Shrink mnt_entry_free a bit
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:17:02 +03:00
Cyrill Gorcunov
3ae67d7b3a mount: Move mount_info and ext_mount to mount.h
It's quite unclean while this structure lives
in proc_parse.h, which only have to fill this
structure on procfs read, but real handling
is inside mount.c. Move it as appropriate.

Same time ext_mount structure should be moved
into a header as well with sane @list name
used instead of @l.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:16:47 +03:00
Cyrill Gorcunov
291e632e60 mount: Reorder declarations
- gather structs on top
 - then extern vars

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-08-13 17:16:05 +03:00