Commit graph

6887 commits

Author SHA1 Message Date
Stanislav Kinsburskiy
49bfd9540d scripts: fix mountinfo parsing in systemd-autofs-restart.sh
Fily system type is not necessarily located in the column number 9.
But look like we can rely on " - " pattern: it's always located immediately
after dash.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
830cb36876 autofs: support of "hidden" catatonic mounts
There can be a situation, when autofs mount is catatonic, but doesn't know
about it yet.
It wasn't possible to distinguish between such mounts and others, which are
active, but not accessible for some reason. And all of such mounts were
threated as undumpable.
Such "hidden" catatonic mounts can appear if:

1) autofs master process has exited without switching
   the mount to catatonic mode (or was killed).

2) mount point was unmounted, but not propagated to
   nested mount namespace with private mounts.

These mounts can be handled by accessing the mount point. If it's catatonic,
it will update it's internals on first failed request to the autofs master.
Then we can read options again and dump the mountpoint as catatonic.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
e853848b5b autofs: rework pipe search logic a bit
No not return error from autofs_find_pipe_read_end, if pipe end wasn't found,
because read_fd remains negative.
There is another explicit check in the caller of this function for read_fd and
proper messages are printed in such a case.
Return -ENOENT in case of read end of the pipe doesn't exist to distinguish
with other error types (will be used later).

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
9f89937468 scripts: do not use stat to discover fs type in systemd-autofs-restart.sh
Unfortunatelly, autofs doesn't allow to discover it's type. At least without
accessing master process. That means, that stat can be used to determine
whether some other file system is mounted on top of autofs (which we need to
take a decision whether to move restore fs aside or not), because it simply
stuck.
This patch does fs type discovering by parsing CTs mountinfo.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
40682f1561 scripts: save and restore target mount for autofs service
This patch slightly changes the logic on systemd autofs service restart script:

1) It tries to bind-mount the mountpoint on top of autofs (if any) somewhere
before service restart, and replace new mount point on top of autofs (if any)
by the saved one after.

2) It doesn't exit in case of error, trying to recover as much as
possible in case of failure instead and then continue services restarting.

The reason for introducing new logic is that there can be some other,
stateful, file system on top of autofs (say, tmpfs), which state was restore
during migration.
With current script this state will be lost, while this patch allows to
preserve restored mount point after service restart.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
72d63211c2 autofs: do not create dentries for indirect mount on bind-mounts
This was a silly mistake: bind-mounts share the same superblock, thus dentry
creation on a bind-monut will fail with EEXIST.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
1d79f6e96d autofs: collect new pipe fd as used
This is essential to make sure, that we won't use the same pipe descriptor for
different pipes.
Otherwise we can run into problem with fd send via unix sockets.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Cyrill Gorcunov
4d4d5c0f2a build: uninstall -- Cleanup systemd-autofs-restart.sh script
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
542bb238d7 sources: fix pr_perror usage
This is log cleanup patch.
Pr_perror prints new line by itself.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
31a260264f autofs: use temporary value for virtual pgrp on dump
Otherwise information about real pid is lost in case of pid_to_virt returned
zero. This is required to output the real pid in error message instead of
always outputting zero (result of pid_to_virt).
IOW, would be nice to know the process pid we failed to find in the tree.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
63d61425b7 scripts: join pid namespace in systemd-autofs-restart.sh
Without correct pid namespace systemctl is not able to determine whether
autofs is active or not.
The reason is unaccessible proc due to mount namespace change without pid
namespace change.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Cyrill Gorcunov
820c9d06ce autofs: install -- Ship scripts/systemd-autofs-restart.sh
This will be installed into $(prefix)/libexec/criu/scripts.

Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
10ffc78dfb scripts: systemd-autofs-restart.sh added
This script restarts systemd autofs services to workaround a problem, when
systemd doesn't consider autofs mount as own after restore (alien device ID
problem)

v4:
Environment variable NS_PID was renamed to CRTOOLS_INIT_PID

v2:
1) Added different checks: for process with pid, active service, systemd based
container.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
4635b53846 autofs: free leaked opts in autofs_mount
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
3308134849 autofs: free leaked info in autofs_mount on error path
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
42a725364b autofs: free leaked AutofsEntry in autofs_dump_entry
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
240de36f54 autofs: do not close NULL image
This will lead to segmentation fault.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
00340443f4 autofs: fix device id modifier on error path in autofs_mnt_open
Type dev_t corresponds to "unsigned long".

v2: explicitly cast to "long"

Signed-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
a85968ebc9 autofs: fix device id printf modifier on error path in autofs_mnt_open
Type dev_t corresponds to "unsigned long".

Signed-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
eb7893e90e autofs: do not treat old kernel as error in autofs_parse()
Otherwise dump fails.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Andrew Vagin
6c9da55f65 autofs: include limit.h before auto_fs.h
In file included from /home/travis/build/xemul/criu/criu/include/autofs.h:16:0,
                 from autofs.c:7:
/usr/include/linux/auto_fs.h:54:12: error: ‘NAME_MAX’ undeclared here (not in a function)
  char name[NAME_MAX+1];

In file included from /home/travis/build/xemul/criu/criu/include/autofs.h:16:0,
                 from autofs.c:7:
/usr/include/linux/auto_fs.h:54:12: error: ‘NAME_MAX’ undeclared here (not in a function)
  char name[NAME_MAX+1];

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Mike Rapoport
935a2bfa46 autofs: fix build on Fedora 22
The following error happens when building CRIU on Fedora 22:

  CC       autofs.o
autofs.c: In function ‘autofs_mount’:
autofs.c:892:9: error: implicit declaration of function ‘add_post_prepare_cb’ [-Werror=implicit-function-declaration]
   ret = add_post_prepare_cb(autofs_add_mount_info, mi);
         ^
cc1: all warnings being treated as errors

Adding forward declaration of add_post_prepare_cb resolves the issue.

Signed-off-by: Mike Rapoport <rapoport@il.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
8601487a8d cr-restore: move add_ns_shared_cb declaration to include/namespaces.h
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
b3243983dc check: "autofs" feature added
The only way to check, whether autofs migration is supported  from the kernel
side is to check actual mount point options (search for "pipe_ino" option).
This checker first tries to find autofs on host. If there is no any, temporary
mounts autofs by itself.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
4cdabe9531 zdtm.py: create "dev/autofs" root contruction
Required for test/zdtm/static/autofs test.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:15 +03:00
Stanislav Kinsburskiy
54a333a0b9 zdtm: add autofs test
1) Support autofs kernel-user exchange protocol
2) Test mounts: direct, indirect, offset (?) (migrated and operational).
3) Test cases, when write end of the pipe is closed, and when it's not.
4) Test catatonic mounts.
5) Test nested mounts are migrated (tmpfs suits it good)

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Stanislav Kinsburskiy
12a253bea8 mount: create target directory for AutoFS indirect mounts.
In case of mounting AutoFS indirect mount points, target dentry doesn't exist
and has to be created.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Stanislav Kinsburskiy
dca4f4f212 autofs: restore stage introduced
AutoFS mount point is managed by user space daemon, which receives requests
from kernel via pipe, passed on mount operation.
Kernel hold write end, while user space process - read end.
Thus, for successfull AutoFS migration, this connection has to be restored.

Autofs restore is tricky. Mount point is created by init process in pair with
per-mount context to be able to fix up actual kernel-userspace pipe
connection, when all the mount points are restored.

The problems with restoring pipe connection are:

1) It has to be done from actual AutoFS mount point master process context,
because pipe and pgrp values are taken from current in kernel.
2) Actual mounts are created by "init" process, and mount point owner (master)
have to set later.
3) To update mount point master one requires an opened write end of the pipe.

To provide AutoFS mount point master with resources, mentioned above, the
following was implemented:

1) If mount master doesn't have write pipe end opened, it is created as a
clone of read pipe end file descriptor and added to master's fds list. This
end is required to reconfigure mount point master.
2) Another pipe fle is created with explicit "post_open" callback, which is
used for actual mount point reconfiguration.
3) Mount point in created by init process. Mount data, required to restore
the owner, is copied to shared memory location by post-mount callback.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Stanislav Kinsburskiy
e670a1c034 autofs: declare ioctl helpers and constants
This structures and helpers are needed to simplify autofs mounts reconfiguring
during restore.
Note: taken from automount package.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Stanislav Kinsburskiy
c860b540c1 pipes: export collect_one_pipe_ops() helper
This helper is used by autofs restore to add temporary pipe structures.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Stanislav Kinsburskiy
87be218c95 files: new dup_fdinfo() and dup_fle() helpers introduced
This helpers will be used by autofs restore to create temporary pipe
descriptors.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Stanislav Kinsburskiy
7e12d2dd5b files: new "used" files list introduced
This list contains all per-process used file fdinfo's, sorted by fd number.
Will be used to safely create new artificial file descriptors and also allow
to recreate temporary descriptors with original number, if possible, like
AutoFS tries to preserve original pipe write end descriptor, when it was
closed.
This patch also adds a couple of simple helpers to find unused file
descriptor:
1) fd_is_used() does exactly what it is named
2) find_unused_fd() returns "hint_fd" if unused or last used descriptor plus
one.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Stanislav Kinsburskiy
2429f08ba8 autofs: dump fsinfo stage introduced
AutoFS mount point is managed by user space daemon, which receives
requests from kernel via pipe, passed on mount operation.
Kernel hold write end, while user space process - read end.
Thus, for successful AutoFS migration, this connection has to be
restored.
During this stage, all the autofs parameters and parsed and collected in
per-mount autofs structure. It also does check that autofs mounts is not in
interim state.

Below are major tricks to be performed to dump AutoFS mount:

1) Read end of the pipe in the process have to be discovered: it will be used
to restore the pipe in case of write pipe end in closed in the process.
Note: migration of AutoFS mounts, which process group leader doesn't have read
pipe end opened is not supported.

2) Read pipe end has to be empty. Otherwise autofs is an interim state.
Interim state is determined by control pipe contents: if it's not empty, then
it means, that kernel requested some operation (mount/umount), which is in
process right now.
In case of pipe is not empty, dump is aborted.

3) Mount points are collected (parsed) from initial pid namespace, which leads
to real pgrp value in AutoFS options instead of virtual one. This have to be
fixed.
Note: we don't care about virtual pgrp in case of catatonic mounts

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Stanislav Kinsburskiy
e2f1a0da21 autofs: parse fsinfo stage introduced
Autofs uses packetized pipe (with O_DIRECT), migration of which is not
supported.
Luckely, because we support only empty autofs pipes, they can be collected
into some list and then explicitly treated as normal pipes on dump.

Note: packetized mode is set by kernel inself on mount operation. So, we don't
need to carry the flag at all.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:18:14 +03:00
Stanislav Kinsburskiy
4d31b38a0d protobuf: autofs entry introduced
This entry will be used to carry all the autofs parameters, required to
restore mount point.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:06:58 +03:00
Stanislav Kinsburskiy
c8911f2859 devices: add support for /dev/autofs
This device doesn't support read or write operations and is expected to be
created by external process.
Thanks to that, regular dump options suits this device.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:06:58 +03:00
Stanislav Kinsburskiy
3ca46335d3 protobuf/mnt.proto: AutoFS type added
Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-05 23:06:58 +03:00
Andrei Tuicu
3dfb785493 Fix dumping of /proc folder
CRIU fails to dump processes that have a file descriptor pointing
to the /proc folder, because check_path_remap returns error code
in that case. Fix: return 0 instead.

Signed-off-by: Andrei Tuicu <andrei.tuicu@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-04 21:37:37 +03:00
Tycho Andersen
00ad31129d tty: fix typo
This is supposed to be an else if.

CC: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-04 21:37:37 +03:00
Tycho Andersen
048257cbba remove unused field nr_zombes from rst_info
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-04 21:37:36 +03:00
Cyrill Gorcunov
316820c357 tty: Don't forget to add eol when inverting slave pts paths
Otherwise next strcat get confused

 | (00.024843)     26: Error (files-reg.c:1528): Can't open file dev/pts/g:��^?ptmx on restore: No such file or directory
 | (00.024846)     26: Error (files-reg.c:1470): Can't open file dev/pts/g:��^?ptmx: No such file or directory
 | (00.024849)     26: Error (tty.c:545): tty: Can't open dev/pts/g:��^?ptmx: No such file or directory

Reported-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Tested-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-07-04 21:37:36 +03:00
Cyrill Gorcunov
8ba63724c1 tty: Don't forget to setup peers mode on restore
In commit c6bc7259c we've started to carry @mode of the
files we're opening on restore, implying they are
static and should not be changed. This is true for
regular files but the pty peers are created
dynamically so if someone have set some special
mode beore the checkpoint procedure we will fail
on restore when regular file engine test it. So lets
setup @mode unconditionally.

https://travis-ci.org/xemul/criu/jobs/140011141

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:15:28 +03:00
Dmitry Safonov
6d0982783a pagemap: include falloc.h for FALLOC_FL_PUNCH_HOLE
Otherwise on some older environments like RHEL7 it will fail to build with:
  CC       pagemap.o
pagemap.c: In function ‘punch_hole’:
pagemap.c:54:40: error: ‘FALLOC_FL_PUNCH_HOLE’ undeclared (first use in this function)
    ret = fallocate(img_raw_fd(pr->pi), FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
pagemap.c:54:40: note: each undeclared identifier is reported only once for each function it appears in
pagemap.c:54:63: error: ‘FALLOC_FL_KEEP_SIZE’ undeclared (first use in this function)
    ret = fallocate(img_raw_fd(pr->pi), FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
make[2]: *** [pagemap.o] Error 1

CC: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:15:28 +03:00
Andrew Vagin
1d0fcfa8f7 zdtm: don't run cgroup04 concurrently with other cgroup tests
It uses --manage-cgroup full and can dump and restore cgroup of other tests.

Reported-by: Mr Jenkins
Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:15:28 +03:00
Mike Rapoport
8cb9a33e61 criu: pagemap: make punch_hole static
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:15:28 +03:00
Mike Rapoport
3359824e60 criu: shmem: use page_read->read_pages rather than its inline implementation
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:15:28 +03:00
Mike Rapoport
5cad725198 criu: dedup/pagemap: move most of the dedup code to pagemap.c
The deduplication code uses pagemap internal implementation details, so
it's better to have this code in the pagemap.c

Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:15:28 +03:00
Mike Rapoport
d12d52429d criu: mv page-read.[ch] pagemap.[ch]
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:15:26 +03:00
Andrew Vagin
84bf1ad467 mount: don't do MS_REC|MS_PRIVATE for host mounts
Here is a race when someone umounted something and this operation
isn't propagated into our namespace.

CRIU					| Another process
-----------------------------------------------------------------
pivot_root(".", put_root)		|
mount(put_root, MS_REC|MS_PRIVATE)	|
					| umount /xxx/yyy
					| umount /xxx -> EBUSY
umount(put_root)

We do this to not affect mounts in put_root, but we can mask
these mounts as slave and this will work for us and for external
users.

Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:15:08 +03:00
Tycho Andersen
bdc972fd7f cgroup: s/pids.current/pids.max
pids.current is the current number of pids, not the maximum number allowed
(which is the thing we care about, that is set by the user).

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2016-06-28 13:14:33 +03:00