2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-28 04:48:16 +00:00

40 Commits

Author SHA1 Message Date
Pavel Emelyanov
65408e927f page-read: Fix compilation on arm (2)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-12 23:51:15 +03:00
Pavel Emelyanov
efb31988ec page-read: Fix compilation on arm
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-12 23:27:57 +03:00
Pavel Emelyanov
7d72537dbd page-read: Properly handle overlapping pagemaps in stack
If the pagemap we read at some point covers two (or more) pagemaps
in parent images, we cannot just call the parent page read for all
those pages. Instead, we must call parent page read with shorter
requests so that it handles its own pagemaps properly.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-12 15:58:43 +03:00
Pavel Emelyanov
780d699401 page-read: Teach page-read to read multiple pages at once
This is preparatory patch, the problem to solve is described in
the next one.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-12 11:14:43 +03:00
Adrian Reber
7b32bee414 page-read: print missing page address in hex
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-11-10 15:57:05 +03:00
Pavel Emelyanov
f7f76d6ba6 img: Introduce empty images
When an image of a certian type is not found, CRIU sometimes
fails, sometimes ignores this fact. I propose to ignore this
fact always and treat absent images and those containing no
objects inside (i.e. -- empty). If the latter code flow will
_need_ objects, then criu will fail later.

Why object will be explicitly required? For example, due to
restoring code reading the image with pb_read_one, w/o the
_eof suffix thus required the object to be in the image.

Another example is objects dependencies. E.g. fdinfo objects
require various files objects. So missing image files will
result in non-resolved searches later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-13 14:42:54 +03:00
Pavel Emelyanov
45a0cc4234 page-read: Explicitly mark ENOENT with return code
When page-read fails to open the pagemap image it reports error.
One place (stacked page-reads) need to handle the absent images
case gracefully, so fix the return codes to make this check
work.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-13 14:42:11 +03:00
Pavel Emelyanov
dceb6633c7 page-read: Introduce custom flags for opening
Instead of open flags and boolean is_shmem argument.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-03-04 17:50:32 +03:00
Pavel Emelyanov
295090c1ea img: Introduce the struct cr_img
We want to have buffered images to speed up dump and,
slightly, restore. Right now we use plan file descriptors
to write and read images to/from. Making them buffered
cannot be gracefully done on plain fds, so introduce
a new class.

This will also help if (when?) we will want to do more
complex changes with images, e.g. store them all in one
file or send them directly to the network.

For now the cr_img just contains one int _fd variable.

This patch chages the prototype of open_image() to
return struct cr_img *, pb_(read|write)* to accept one
and fixes the compilation of the rest of the code :)

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
2014-09-30 21:48:13 +04:00
Pavel Emelyanov
3b995f1aef iov: Add iovec2pagemap() helper
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-06-20 16:35:52 +04:00
Tikhomirov Pavel
5e7d4bb0c1 page-read: remove redundant initialisation
previous init of pr->parent at line 220

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-21 08:38:18 +04:00
Andrey Vagin
c4979e9cec page-read: initialize parent to NULL
For example restore_shmem_content allocates the page_read structure on
stack.

Cc: Pavel Emelyanov <xemul@parallels.com>
Reported-by: Jenkins Criuovich
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-18 15:36:34 +04:00
Tikhomirov Pavel
670d1ce856 v2 page-read: rework open_page_read to use in shmem restore
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-18 11:48:58 +04:00
Tikhomirov Pavel
32a48b67b7 v2 deduplication: bunch neighbour data to punch together
when decide that data is no longer needed, there are two cases:
-if data neighbours previous block of "no needed" data, extend bunch
block(it holds begining and size of concequent "no needed" data) by
length of curent block and go next.
-if data not neighbours bunch block(or bunch block size will be bigger
than MAX_BUNCH_SIZE), than we punch bunch block and set bunch block
to curent block.

in the end make cleanup to punch last bunch block.

changes in v1:
punch_hole takes whole page_read
make restriction more precise

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-03-07 14:31:29 +04:00
Pavel Emelyanov
391e4bd7b9 page-read: Sanitize opening routines
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 15:19:19 +04:00
Tikhomirov Pavel
f0a6d32cd4 v2 deduplication: add auto-dedup on restore
if option --auto-dedup is set on restore, then as soon as page is
restored it will be punched from the image.

open image in O_RDWR mode

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-28 14:11:49 +04:00
Tikhomirov Pavel
c3c0acfe76 deduplication: make seek_pagemap_page properly handle eof
because eof in restore means that we don't have "must have" data, so
it mean error exit, but in dedup, it's ok not to have data we seek, so
we continue returning normally

also it's used that if off < pr-cvaddr then no eof happened and if eof
happened then off >= pr-cvaddr(then return of seek_pagemap_page is 0)

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-24 15:50:24 +04:00
Pavel Emelyanov
7b6a92c201 page-read: Fix pagemap message formatting
The vaddrs should be %x.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-01-23 13:23:53 +04:00
Andrey Vagin
73b689f81b page-read: Don't check that an image file contains data
Modern tar and rsync can replace zero chunks with holes. So it's valid situation
and shouldn't abort the restore.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-26 22:49:37 +04:00
Andrew Vagin
a0049bfe6a crtools: fixed format strings
Use the format specifier %zu instead of %lu to print a size_t integer.

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-26 11:10:00 +04:00
Pavel Emelyanov
ba96e646a4 page-read: Fix naming
The open_page_at one is quite obfuscating.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:55:22 +04:00
Pavel Emelyanov
55b96d0113 page-read: Fix compilation on older distros
SEEK_DATA appeared quite recently, define it if not present
in system headers.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:53:30 +04:00
Tikhomirov Pavel
41433f4043 v3 deduplication: add auto-dedup local
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:52:04 +04:00
Tikhomirov Pavel
5db1adc567 v3 page-read: add open_page_rw to open pages in O_RDWR mode
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:51:20 +04:00
Tikhomirov Pavel
6336d537ac v3 page-read: make function seek_pagemap_page can be used in dedup
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:51:09 +04:00
Tikhomirov Pavel
0f90727ddb v3 page-read: add reuse posibility of pagemap2iovec
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:50:49 +04:00
Tikhomirov Pavel
530b6d11fd v3 page-read: replace read_pagemap_page_from_parent with seek_pagemap_page
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:50:48 +04:00
Tikhomirov Pavel
c49219bf6a v3 page-read: add print error in case of bad or corrupted image
1. add it instead of BUG_ON
we should print error if warn is assigned to true
2. correct use of read_pagemap_page_from_parent, provide warn = true

Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:50:45 +04:00
Tikhomirov Pavel
164bc4bdf1 v3 page-read: check that don't read page from hole
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-18 14:50:44 +04:00
Tikhomirov Pavel
7be5a1b95d v2 page-read: Check parent pagemap read return value
Signed-off-by: Tikhomirov Pavel <snorcht@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-12-02 15:28:59 +04:00
Andrey Vagin
07fc6cf394 crtools: don't include image.h in crtools.h
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 15:42:09 +04:00
Andrey Vagin
824403a009 crtools: create new header for servicefd stuff (v2)
v2: generate patch relative to the official git.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-11-06 12:43:02 +04:00
Andrey Vagin
4e6cd36885 page-read: print errno in case of failure
(00.023059)   3898: Error (page-read.c:129): Can't read mapping page -1: Bad address

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-08-28 17:00:17 +04:00
Andrey Vagin
dd38ae16d1 mm: handle new processes which created between snapshots (v2)
These processes don't have image files in a parent snapshot and crtools
should not fail in this case.

https://bugzilla.openvz.org/show_bug.cgi?id=2636

v2: return NULL from mem_snap_init, if a parent image is absent.
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-06-27 23:47:15 +04:00
Andrey Vagin
c97911a5f2 mm: initialize PageEntry pe to NULL in PagemapEntry
Otherwise it contains trash and BUG at page-read.c:98 may be triggered.

https://bugzilla.openvz.org/show_bug.cgi?id=2633

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-06-22 13:15:27 +04:00
Alexander Kartashov
4d4543f66e page-read: fixed format strings
Use the format specifier PRIx64 instead of %lx to print an off_t integer.

Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-30 18:31:35 +04:00
Pavel Emelyanov
febdd8a2bf page-read: Factor out PagemapEntry to iovec conversion
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-16 14:36:05 +04:00
Kir Kolyshkin
d90d4b1b88 Fix typos in log messages
Someone has to do it, right?..

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-15 12:46:25 +04:00
Pavel Emelyanov
3307bfd8f1 restore: Restore memory from stack of snapshots
This one is a little bit more tricky that dump. On restore we
should open the chain of pagemap-s (by "parent" links). Then for
every pagemap with in_parent set we should go to parent and ask
for the page. Parent, in turn, should properly determine where
the respective page is in his pagemap and position the page.img's
position respectively.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:22 +04:00
Pavel Emelyanov
757f9c570f page-read: New abstraction for restoring pages
Now we have 2 forms of storing pages -- legacy pages.img and
new pagemap + pages image. We'll have one more (ovz) and the
pagemap + pages will be stacked (snapshot restore). Thus it's
handy to have this as an page-reader object.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2013-04-12 19:45:12 +04:00