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

9635 Commits

Author SHA1 Message Date
Cyrill Gorcunov
34b2ba0c06 sockets: Update unix_diag.h
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-10 17:26:50 +04:00
Cyrill Gorcunov
942355c166 sockets: Nitpick for dgram dumping
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-10 17:26:50 +04:00
Cyrill Gorcunov
054bf4ada2 sockets: Allow to dump dgram sockets
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-10 17:26:50 +04:00
Cyrill Gorcunov
04ec43a5d5 sockets: Split open_unix_sk to stream and dgram versions
And add some comments.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-10 17:26:50 +04:00
Cyrill Gorcunov
cc15c01832 test: Rewrite sockets test
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-10 17:26:50 +04:00
Andrey Vagin
eac52b6090 util: reopen_fd_as to return an error if destination descritor is busy
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-10 16:55:02 +04:00
Andrey Vagin
f274f16081 log: close unused descriptor
This code opens a log file and duplicates the descriptor to logfd,
but forgets to close the first one.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-10 16:43:31 +04:00
Cyrill Gorcunov
5d5e8b801c retore: Fix up shared anonymous memory restore procedure
Restorer does really restore shared memory (including page
contents restore) only on master process, while all other
processes do open such memory area via map_files/ procfs entry
so that we might have a situation when shared VMA is present
in some particular core-%d.img file but it's not listed in
collected shmems array and find_shmem_by_pid will return NULL.
This is perfectly fine, be ready for that.

Another issue is that shared memory might look like

CR_FD_SHMEM: /home/cyrill/projects/kernel/crtools/shmem-2641.img
----------------------------------------
0x7f2200775000-0x7f2200776000 id 19664
0x7f2200776000-0x7f2200777000 id 19663
----------------------------------------

So vma area is [x;y) range and we should distinguish two
shmem lookup cases

 - one when we search for page in shmem area
 - second when we lookup shmem area in collected ranges

They both have a different lookup conditions so single
find_shmem splitted into two helpers find_shmem and
find_shmem_page as appropriate.

This patch finally fixes the three process asynchronious
shared memory updates test-case.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 18:31:48 +04:00
Cyrill Gorcunov
1b21a27b0c restore: Simplify shmem_wait_and_open
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:41:05 +04:00
Cyrill Gorcunov
d0a6e9a101 restore: Pass shmems_fd as argument as well
We might be needing to close the shmems file descriptor.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:40:54 +04:00
Cyrill Gorcunov
4416c649c8 syscalls: Add sys_msync helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:40:35 +04:00
Cyrill Gorcunov
e0e934aa4b restore: shmems -- Use cr_wait_init helper
Just in a sake of consistency

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:40:24 +04:00
Cyrill Gorcunov
86d114438e lock: Add cr_wait_init helper
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:40:13 +04:00
Cyrill Gorcunov
793f3aa947 restore: shmem_remap arguments resort
Style tuning, no func change

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:39:58 +04:00
Cyrill Gorcunov
5b47af26f5 restore: No need to check if vma_entry->fd == -1
Dumping procedure does check for VMA_ANON_SHARED
so the same should be done at restore time.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:39:44 +04:00
Cyrill Gorcunov
1238d2dd72 restore: Signal waiters on shmem being read only when pages data is restored
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:39:29 +04:00
Cyrill Gorcunov
e189efc176 restore: shmems -- Fix /proc path
The remapping of /proc path to shmem should be
done with pid of process which did mmap() call
initially.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:39:08 +04:00
Cyrill Gorcunov
58ad088870 restore: Fix typo in shmem_wait_and_open
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:38:44 +04:00
Cyrill Gorcunov
80492c78e6 restore: More detailed log on shmem restore
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:38:18 +04:00
Cyrill Gorcunov
a03e3622f2 restore: Add log message that restore via sigreturn is started
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:38:04 +04:00
Cyrill Gorcunov
3afb83299c restore: Gather setting agrument for sigreturn code in one place
Also add a few more comments.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:37:41 +04:00
Cyrill Gorcunov
ee0f17b0a7 restore: Fix typo in shmem size assignment
And use SHMEMS_SIZE constant as well.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:37:12 +04:00
Cyrill Gorcunov
a14ceb4950 util: Fix parse_maps to handle anonymous shared mappings
In commit 99eb3d09c5c42200b230783e793b778882ce8dd6
we started to use self-contained shared memory
region but it revealed the problem that anonymous
sgared mappings might be parsed by parse_maps incorrectly,
so fix it and be ready to get anon-shared mappings.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2012-01-04 16:36:56 +04:00
Cyrill Gorcunov
f3ed69a339 sockets: Print socket id as well
Also make output a bit more fancy, as

CR_FD_UNIXSK: unixsk-2440.img
----------------------------------------
fd    3 type  1 state  1 namelen    0 id  19406 peer  19407
fd    4 type  1 state  1 namelen    0 id  19407 peer  19406
fd    5 type  2 state  7 namelen    7 id  19408 peer      0	---> [tst-sk]
fd    6 type  2 state  7 namelen    0 id  19409 peer      0
fd    7 type  2 state  7 namelen    0 id  19410 peer  19411
fd    8 type  2 state  7 namelen    8 id  19411 peer      0	---> [tst-sk1]
----------------------------------------

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-30 18:24:55 +04:00
Pavel Emelyanov
5f7d677fad crtools: Sanitize collect_mappings path buffers usage
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-30 16:25:42 +04:00
Cyrill Gorcunov
2967bb9c37 sockets: Use reopen_fd_as helper
It also tests for possible dup() call error.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-30 15:34:05 +04:00
Pavel Emelyanov
96f92ee612 crtools: Cleanup open_image_ro
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-29 19:56:34 +04:00
Pavel Emelyanov
7b0b203b34 crtools: Use open_image_ro where appropriate
Several places just need to open an image, thus the helper is OK to use.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-28 21:38:00 +04:00
Pavel Emelyanov
329d8aa662 The pid == 0 is enough.
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-28 21:16:02 +04:00
Pavel Emelyanov
d4fd91046f crtools: Remove duplicate show_single_file boolean
It duplicates the show_dump_file pointer.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-28 21:15:55 +04:00
Pavel Emelyanov
a76922ebc0 crtools: Fix lost magic arg from print
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-28 21:15:21 +04:00
Cyrill Gorcunov
935c8e75f0 net: sockets -- Use read_ptr_safe for magic number test
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-28 12:17:02 +04:00
Cyrill Gorcunov
4432c6447e net: sockets -- A few style tuneups
To follow rest of code

 - use !x for xalloc result tests
 - structure members are tab aligned
 - multiline assignments over structure members are aligned as well

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-28 12:16:51 +04:00
Cyrill Gorcunov
bc3370fc47 net: sockets -- Dont use multiline for() without braces
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-28 12:16:36 +04:00
Cyrill Gorcunov
269fb0b777 net: libnetlink -- Drop trailing whitespaces
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-28 12:16:11 +04:00
Cyrill Gorcunov
c53408d6b7 net: sockets -- Make sure ue->namelen < UNIX_PATH_MAX
UNIX_PATH_MAX is a size of path, so max length
should never be equal to such size.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 23:32:17 +04:00
Cyrill Gorcunov
2ae99d73b9 net: Define named constant for nlmsg_seq
For better readability.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 20:13:18 +04:00
Cyrill Gorcunov
25d048c02a test: Add usnix-socket test
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 20:01:47 +04:00
Cyrill Gorcunov
843747de55 net: A few changes in headres to follow c99
Since we're not system library

 - no underscopes in functions name until really needed
   and known to not clash with posix namespace
 - empty line between system headers and own headers
   for readability
 - extern for function prototypes

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 14:26:13 +04:00
Cyrill Gorcunov
f532e9fed2 net: sockets -- Use dprintk helper
Drop USK_DEBUG, we have dprintk which is active
if compiled with make DEBUG=1

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 14:26:02 +04:00
Cyrill Gorcunov
ccd5e2295f net: sockets -- Replace __u32 with u32
We provide such type in types.h.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 12:41:42 +04:00
Cyrill Gorcunov
00e14f0448 make: Add DEBUG=1 option
This allows to use pr_debug and dprintk helpers.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 02:28:12 +04:00
Cyrill Gorcunov
4c0fb12e11 util: Make pr_warning to report file and line as well
For easier debugging. We can zap it at release time.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 02:28:02 +04:00
Cyrill Gorcunov
e6a033fb05 net: libnetlink -- Add #ifdefs to escape system header conflict
Otherwise getting errors like

 | CC       libnetlink.o
 | In file included from libnetlink.c:4:0:
 | ./include/libnetlink.h:34:0: error: "NLMSG_LENGTH" redefined [-Werror]

And make macros a bit more readable.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 01:41:17 +04:00
Cyrill Gorcunov
2f85054ddf libnetlink: Drop tailing whitespaces
Cosmetic change.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 00:24:23 +04:00
Cyrill Gorcunov
4a015bba33 sockets: Use safe snprintf
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-27 00:17:24 +04:00
Andrey Vagin
aeb638f845 restore: shmem -- Don't poll, use wait helpers instead
Signed-off-by: Andrey Vagin <avagin@openvz.org>
[gorcunov: A few tuneups]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 23:54:18 +04:00
Andrey Vagin
bd8b2b0f11 restore: shmems -- Remap shmems to use in restorer
Signed-off-by: Andrey Vagin <avagin@openvz.org>
[gorcunov: log error in restorer.c]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 23:54:18 +04:00
Andrey Vagin
99eb3d09c5 restore: shmem - Add self-contained shem's memory region
The next patch will remap shmems region and will use it in restorer.
Actually this patch moves shmem_nr to struct shmems.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
[gorcunov: Various tuneups]
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 23:54:18 +04:00
Andrey Vagin
74a56b8c5a restore: pipes -- Don't poll, use wait-helpers instead
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
2011-12-26 23:54:18 +04:00