2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00
Commit Graph

787 Commits

Author SHA1 Message Date
Pavel Emelyanov
21bbfee919 proc: Read exit code from /proc/pid/stat
Requires patch #14 (for kernel). Also check for number of entries read be
at least required, not exactly equal for forward compatibility.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-23 01:43:28 +04:00
Pavel Emelyanov
dd495ba18a dump: Factor out img header dumping
Move common code for tasks and threads dumping into routine. It will be
used for zombies as well.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-23 01:43:19 +04:00
Pavel Emelyanov
164ccc095f crtools: R/W API rewrite
Kill all the macros for reading/writing image parts. New API looks like

* write_img_buf/write_img
  Write an object into an image. Reports 0 for OK, -1 for error. The _buf
  version accepts object size as an argument, the other one uses sizeof()

* read_img_buf/read_img
  Reads an object from image. Reports 0 for OK, -1 for error or EOF.

* read_img_buf_eof/read_img
  Reads an object from image. Reports 1 for OK, 0 for EOF and -1 for error.
  This is not symmetrical with the previous one, but it was done deliberately
  to make it possible to write code like

  ret = read_img_bug_eof();
  if (ret <= 0)
	return ret; /* 0 means OK, all is done, -1 means error was met */.

  ... /* 1 means object was read, can proceed */

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-23 01:43:10 +04:00
Pavel Emelyanov
dbf3c1a8cd crtools: Reformat core_entry
Keep task arch-independent fields in one struct (will be extended) in the
beginning of the image and make pads be located separately.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-23 01:43:00 +04:00
Pavel Emelyanov
cf0550ce61 dump: Images opening rework
Rename prep_cr_fdset_for_dump into cr_fdset_open and make it reentable, i.e.
every next enter will open more files in the same fdset. Required for zombies
and makes the code cleaner.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-23 01:42:51 +04:00
Pavel Emelyanov
cfbb9239ec dump: Move threads dumping into task dumping routine
This is to make sure we dump zombies w/o threads.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-23 01:42:42 +04:00
Pavel Emelyanov
8092d77bd3 dump: Rework task stats parsing and dumping
Move the /proc/pid/stat parsing before anything in dump_one_task (prepare
for zombies dumping) and cleanup the rest of the code accordingly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-23 01:42:31 +04:00
Pavel Emelyanov
f1347e1d9b dump: Remove core addresses checks
These are checking in proc parse routine anyway.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-23 01:42:21 +04:00
Stanislav Kinsbursky
af76a228ed makefile: untie misc targets from dep files
Such targets as "tags", "cscope" and "clean" doesn't require blob headers to
be rebuilt.
Thi patch remove this dependence.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-20 19:52:36 +04:00
Stanislav Kinsbursky
949b11b33e makefile: add dependence on restorer dep file
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-20 18:02:53 +04:00
Stanislav Kinsbursky
9697f49812 makefile: remove obsolete variables
We just don't need them

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-20 18:02:41 +04:00
Cyrill Gorcunov
4184d2f6a6 sockets: Rename struct inet_diag_req to inet_diag_req_v2
There was API change in linux kernel 3.2 -> 3.3 transition

 | commit c8991362a0d3cf317dfbfb6cb946607870654e6d

Reported-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-20 16:40:56 +04:00
Cyrill Gorcunov
48f624ee17 restore: Drop real_pid member from shmem_info structure
It's not needed anymore, it was handing cases
where no fork-with-pid functionality were in
kernel, but now it's simply unneeded.

Also drop redundant getpid() calls.

Passes all tests (except fork test which known to fail).

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parllels.com>
2012-01-20 13:08:06 +04:00
Pavel Emelyanov
cf74b78bdc zdtm: Add simple forking test (it fails now)
I haven't found anything similar in there.

It currently just fails most of the launches because seize doesn't work
with zombies, but I'm working on it...

However, when it manages to miss the zombie it triggers the problem with
freezer (fixed by previous patch).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 22:42:10 +04:00
Pavel Emelyanov
11b7e14a6b dump: Fix task freezing process
Currently we read the children tree of running processes.
This is deadly wrong. Stop task once we open it's proc dir
before descending to its kids.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 22:42:01 +04:00
Pavel Emelyanov
7e8eb76e9d ptrace: Print proper errors when seize failed
I'd appreciate if we get rid of these misleading macros at all eventually...

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 22:41:52 +04:00
Pavel Emelyanov
42cbb5bafc dump: Remove dead code from collect_mappings
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 22:41:42 +04:00
Pavel Emelyanov
6128b88c76 restorer: Use LAST_PID_PATH directly
After Andrey's work with making restorer a regular .o file we can do it
(the pthread00 test doesn't fail on it).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 22:41:32 +04:00
Pavel Emelyanov
2a76c6409c socket: Don't request extensions from inet diag
This eats response skb mem, but we don't need it.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 22:41:24 +04:00
Pavel Emelyanov
381559a7f6 socket: Ignore collection errors for now
We can do it since we may not want to dump the missed sockets.
But later, when we will start dumping containers, we'll better
fail here, rather than in the dump stage.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 22:41:15 +04:00
Cyrill Gorcunov
ff37d32689 Update .gitignore
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 22:00:11 +04:00
Andrey Vagin
1dd20b087a restore: detect that someone failed (v2)
Handle SIGCHLD and if someone failed, nr_in_progress is set to -1.
If crtools notices that nr_in_progress is negative, it kills all
tasks.

v2: * Use named constants for task_entries->start in restorer.c
    * Use SA_NOCLDWAIT when setting sigchild handler,
      this makes sigchild handler simpler.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 16:16:58 +04:00
Andrey Vagin
c8edb0c7e6 syscall: add sys_kill
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 16:16:58 +04:00
Andrey Vagin
e6968f4b08 syscall: add waitpid()
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 16:16:58 +04:00
Andrey Vagin
99498681e6 restore: new mechanism to sync tasks
Now we have only one mutex nr_in_progress, it says how many
tasks are not restored yet. A negative value signs that someone
failed.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 16:16:58 +04:00
Andrey Vagin
4798771c4a lock: add a new primitive cr_wait_until_greater (v2)
to wait while a futex value bigger than defined value.

v2: s/bigger/greater

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-19 16:16:58 +04:00
Andrey Vagin
f00efadd2c This patches improves execution of zdtm tests.
It's really like in VZ.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 23:31:22 +04:00
Andrey Vagin
b601765782 devide commands and options
./crtools CMD [options]
CMD may be show, restore, dump

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 23:31:12 +04:00
Cyrill Gorcunov
e1c1ca3c46 util.h: Cleanup, no func changes
Just drop a couple of spaces and
add a comment.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 18:38:47 +04:00
Pavel Emelyanov
a722abce77 socket: Use read_ptr_safe_eof
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 18:32:20 +04:00
Pavel Emelyanov
8836f20c64 util: Print message when read size is bad
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 18:31:57 +04:00
Pavel Emelyanov
379dde63f5 sockets: Clean usk_img dereference
There's no need in img fd pointer in opening functions.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 18:31:42 +04:00
Cyrill Gorcunov
5c083e128a Revert "zdtm: clean up socket_listen"
This reverts commit 46dc368f31.

There will be another one. Instead of hard rebase I decide to
do a revert instead.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 16:19:31 +04:00
Andrey Vagin
46dc368f31 zdtm: clean up socket_listen
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 15:58:09 +04:00
Stanislav Kinsbursky
3b33e12dad tests: added listening socket migration test
This test is based on socket_aio. It's actually the same, except that socket
binding and listening is done before checkpointing and connection to socket is
done after migration.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 12:39:15 +04:00
Stanislav Kinsbursky
dd0f72f220 restore: IPv4 listening sockets restore support
This patch adds support for restoring IPv4 listening sockets.
Based on unix sockets restore.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 12:39:08 +04:00
Stanislav Kinsbursky
7fc6561c0c show: inet sockets dump parsing support added
Nothing to comment there.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 12:39:04 +04:00
Stanislav Kinsbursky
f3253a40d2 checkpoint: IPv4 listening sockets dumping support 2012-01-18 12:38:58 +04:00
Stanislav Kinsbursky
654216c1df checkpoint: generalize netlink requests code
This is a precursor patch. Netlink request code is mostly the same for any
kind of sockets. Only 2 places differs: request creation and callback address.
This patch parametrizes netlink call function with a pointer to a request
structure, request size and receive callback, which replaces hard-coded unix
sockets parts.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-18 12:38:54 +04:00
Cyrill Gorcunov
74bb5d9a26 Merge branch 'stas-make' into dev
* stas-make:
  make: fix parasite deps
  make: cleanup deps files usage
  make: cleanup deps files mess
  make: cleanup targets mess
  cr-dump: remove unnessesary parasite header

Conflicts:
	Makefile

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 22:17:00 +04:00
Stanislav Kinsbursky
cebc7de227 make: fix parasite deps
Remove explicit parasite targets dependence on deps files and use them as
makefile parts.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:15:02 +04:00
Stanislav Kinsbursky
d1df3f60f9 make: cleanup deps files usage
Objects does not depend on dep files. Dep files provide rules to build object
files. Thus we need to include dep files.
This also leads make to rebuild dep files (if required) before an other
targets.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:14:51 +04:00
Stanislav Kinsbursky
b8f57e0b35 make: cleanup deps files mess
Only two files (parasite-syscall.c and cr-dump.c) depends on parasite code.

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:14:37 +04:00
Stanislav Kinsbursky
d9c107d7a3 make: cleanup targets mess
Targets should be defined after variables

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:14:23 +04:00
Stanislav Kinsbursky
7f2cd4b18a cr-dump: remove unnessesary parasite header
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-17 20:12:36 +04:00
Andrey Vagin
476fbbb6f8 restorer: make messages readable
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
31fb055220 restorer: make BUG_ON more informative
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
2cd82bc7ff restorer: move log descriptor from crtools (v2)
v2: add FIXME for linking restorer-log.c and restorer.c by ld
    I don't know how to do it now.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
74e23867bd restorer: correct indentions
The previouse patch doesn't change it to simplify review

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00
Andrey Vagin
014841825a restorer: isolate restorer like parasite (v4)
Before this patch the restorer's code is linked in crtools and then
we copied functions from it. In this case all function should
be inline and we can't use a global variables.

I suggest to make it like parasite. The restorer's code is isolated in
own file and will be copied wholly.  The restorer's code is compiled as
position-independent code, so we can use functions and global variale
(E.g. to save descriptor for log messages).

v2: correct indentions in a separate patch
v3: introduce a variable restore_task_exec_start symmetrical to
    restore_thread_exec_start
v4: don't give command in restorer_thread()

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
2012-01-17 18:08:03 +03:00