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

2322 Commits

Author SHA1 Message Date
Pavel Emelyanov
11f8bb4705 show: Show *-s for zero sequences in hexdump output
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 19:19:24 +03:00
Pavel Emelyanov
12602aee59 show: Make hexdump output look like hexdump tool one
No spaces between chars and no 0x-s.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 19:00:05 +03:00
Pavel Emelyanov
56e1decf48 show: Factor out skipping of data dump into show_image_data
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 18:57:54 +03:00
Stanislav Kinsbursky
c33a62dfcc ipc: fix silly misprint in IPC shm show handler
IPC shared memory data is aligned by 32 bits.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 17:19:34 +04:00
Pavel Emelyanov
1d1860224e rst: Remove excessive arg from open_vmas()
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 16:08:07 +03:00
Pavel Emelyanov
87fe1834cd rst: Sanitize restore function call flow
The dedicated prepare_and_sigreturn makes code harder to read.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 16:04:46 +03:00
Pavel Emelyanov
25e31a933b pstree: Remove unneeded arg from prepare_pstree_for_shell_job
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 15:54:12 +03:00
Pavel Emelyanov
be79f38d6c pstree: Sanitize pstree preparation code
We have 3 calls for that, two called directly from cr-restore,
one -- from one the former. Clean this mess and write short
comments on each stage.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-10 15:50:47 +03:00
Pavel Emelyanov
2a925722ca show: Show itimers with std pb showing helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 16:34:03 +03:00
Pavel Emelyanov
0026b53678 mnt: Don't allocate PATH_MAX on stack for pivot path
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 16:20:19 +03:00
Pavel Emelyanov
dbbd8d400a rst: Don't allocate PATH_MAX on stack for proc mountpoint
Use direct name assignment, it's enough.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 15:50:41 +03:00
Pavel Emelyanov
da8dbe43bc rst: Move premmaped* variables on rst_info
This thing on pstre_item was created to carry task-specific
information across the "restore" code-flow.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 13:19:01 +03:00
Pavel Emelyanov
39d60cdfef rst: Sanitize sigchld handler
The error handling was not obvious. Clean it up.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 13:08:56 +03:00
Pavel Emelyanov
815049bcdb rst: Fix message about inability to restore pid 1 outside pidns
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 10:58:32 +03:00
Cyrill Gorcunov
d9df71dc87 zdtm: Extend inotify00 test to have ghost file used
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 11:11:22 +04:00
Cyrill Gorcunov
b146fe4af6 inotify: Use ghost files if the watchee is a deleted file, v2
The watch target might be a deleted file. In this case we can't
re-create it on restore procedure.

A typical scenario
------------------

 fd = inotify_init1()
 wd = open(path)
 inotify_add_watch(path)
 unlink(path)
 ... checkpoint ...

here we have a @path which is unlinked but still present in inotify
watch list because inode is not yet freed. And if the program is killed
after checkpoint the last reference to a path get eliminated and inode
get freed from the kernel memory.

Thus any furher attempts to open the path via file handle (note that file
handle can't be used to create new file, the kernel doesn't permit that)
will simply fail.

So if plain opening via file handle failed we assume that at least
the file might be in our ghost files list (we're optimists, right?)
and if we successed we simply use a path generated by ghost file
engine for us.

v2 [by xemul@]:
 - gather reference to ghost file remap early

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 11:11:19 +04:00
Cyrill Gorcunov
7eb33a76a8 ghost-files: Save device and inode in image
Because we need to lookup for ghost files from
inotify system where we only have device/inode
as a key, we save dev/ino in ghost image entry.

Note we use in-kernel format for device to be
consistent with inotify and mount related
code base.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 11:11:10 +04:00
Cyrill Gorcunov
7bd34c699e files-reg: Add a few helpers to access ghost files remaps from inotify
The remap_put will be needed to defer unlinking of ghost files
if they are referred from inotify system.

The lookup_remap is needed to figure out if the watch
target the inotify has present in ghost files list.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 11:10:14 +04:00
Cyrill Gorcunov
746ac3fee5 files-reg: Move struct file_remap to the header
We will need to use it in inotify code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-06 11:10:10 +04:00
Pavel Emelyanov
bae3324447 ghost: Cleanup ghost file dumping
No need in function-wide fd variable for copying file.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-05 22:59:35 +03:00
Pavel Emelyanov
679c5326c3 ptrace: Remove dead code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 23:33:06 +04:00
Pavel Emelyanov
4cd9998544 rst: Brush up fake vs real tasks post-pgid restore codeflow
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 18:49:36 +03:00
Pavel Emelyanov
9e7ae345db rst: Remove unused arg from restore_one_helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 18:43:28 +03:00
Cyrill Gorcunov
fdc56e53f6 proc_parse: Update inotify format
Since fdinfo patches were merged to -mm
tree the output format has been slightly
changed. So update our tool accordingly.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 19:28:45 +04:00
Andrey Vagin
caf875454f signal: fix logig about SIGMAX (v2)
A value of signo is in [1, SIGMAX].
Currenly signals are enumirated from 1 to SIGMAX, but SIGMAX
is not included. This patch fixes this mestake.

v2: * save backward compatibility
    * set a correct value of SIGMAX = 64. It can not be in a
    separate patch, because a format is changed again.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 19:26:54 +04:00
Pavel Emelyanov
360c50d429 rst: Relax nr_in_progress set in stage switching
When resetting nr_in_progress for next stage no need
in waking up anyone. Nobody waits for it yet :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 17:40:19 +03:00
Pavel Emelyanov
7eaad99ff4 rst: Helper for switching restore stages
Switching to a new stage is 4-step procedure which
deserves its own helper. Besides, now the information
about how many tasks participage in each stage is
collected in one place.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 17:37:13 +03:00
Pavel Emelyanov
e0d0dc821d rst: Rename task_entries->nr to ->nr_threads
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 17:22:45 +03:00
Pavel Emelyanov
2482c5a24b rst: Move initial nr_in_progress initialization
It's better to init it closer to the rest of rst orchestration.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 17:12:37 +03:00
Pavel Emelyanov
70af6cdd62 rst: Helper for restore stage barrier
When finishing a stage we have to report this (decrement the
number of tasks in stage) and wait while stage switch. Write
a helper that does both.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 16:59:41 +03:00
Pavel Emelyanov
fa35517082 check: Check for SO_BINDTODEVICE is get-able
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-04 16:35:58 +03:00
Konstantin Khlebnikov
c327e175c4 zdtm: cmdlinenv00 -- fix false positive fail on 'auxv' corruption after 32-bit -> 64-bit migration
Content of /proc/$pid/auxv declared as array of long and this file hasn't compat layer.

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

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-03 17:40:32 +04:00
Andrey Vagin
bf598fa28c make: fix navigation in vim
If you have an error in parasite.c and execute make from vim,
without this patch vim opens a new file parasite.c in a root directory.

With this patch vim opens pie/parasite.c.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-12-03 14:53:17 +04:00
Stanislav Kinsbursky
03791bc2c3 ipc: add check for new IPC sysctls
This patch adds check for "/proc/sys/kernel/sem_next_id" to make sure, that
kernel supports restore of IPC objects.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-30 20:11:18 +04:00
Stanislav Kinsbursky
cbcd5f6b02 ipc: update to use sysctl
Old interface with modified IPC syscalls is deprecated is replaced sy sysctls.
This patch updates CRIU to use new interface.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-30 17:47:15 +04:00
Pavel Emelyanov
1a7c7d0404 fd: Consolidate . and .. checks in various readdir callers
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-29 21:12:51 +03:00
Pavel Emelyanov
86886b6376 util: Fix vma printing message (pass 2)
Remove the ?: ladder, replace it with opt string directly
get from status flags.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-29 18:16:00 +03:00
Pavel Emelyanov
15cfa1b053 util: Fix vma printing message (pass 1)
Use %#x for hexademical fields, fix names to more human-readable.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-29 17:54:44 +03:00
Cyrill Gorcunov
1bc6fec5fd inotify: Don't forget to close opened files on error path
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-29 18:12:16 +04:00
Andrey Vagin
1bebe80c14 zdtm: execute tests on non C/R kernel (v2)
* add exclude list. Tests from this list are executed only on C/R kernels
* check that a version of a kernel is greater than 3.7

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-29 17:45:42 +04:00
Andrey Vagin
08ffa65ed5 socket: don't fail if DIAG_SHUTDOWN is absent
A error message is printed.

We want to save ability to try crtools on non C/R kernel.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-29 17:43:32 +04:00
Andrey Vagin
d08905bf89 log: add pr_err_once
This function prints an error message only once.
[xemul: change ({}) to do {} while (0)]

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-29 17:43:06 +04:00
Cyrill Gorcunov
fe7339570b proc-parse: Inotify files migh have no watchee assigned
Same as eventpoll -- we might have no watchee assigned
but only inotify descriptor created.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-28 21:49:57 +04:00
Pavel Emelyanov
03d0758df3 Revert "net: Introduce netdev index to name resolver"
This reverts commit ef3771d566dacb8ee9fe71b744d56f08674fe3db.
With new SO_BINDTODEVICE getting API it's not required.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-28 20:27:16 +03:00
Pavel Emelyanov
f43c1c2ade sk: Rework bound-dev dump/restore according to new API
The SO_BINDTODEVICE getter is changed in the kernel (before
official release) to report not index, but name to be in
harmony with setter.

Fix crtools accordingly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-28 20:24:42 +03:00
Pavel Emelyanov
9df1786aea rst: Move and rewrite comment about how restorer blob is prepared
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-27 22:16:00 +03:00
Pavel Emelyanov
14915d01fd rst: Remove unneeded core file 2nd opening
Presumablty it was lost while reworking core entry restore.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-27 22:03:36 +03:00
Pavel Emelyanov
827c633b26 rst: Write pidfile in separate fn
Just for better readability.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-27 21:59:58 +03:00
Cyrill Gorcunov
a016bc84ff zdtm: pthread00 -- Use exit_group where appropriate
Reported-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-27 20:11:10 +04:00
Cyrill Gorcunov
88ec6bc4ce zdtm: pthread01 -- Add human readable signals printouts
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2012-11-27 19:33:43 +04:00