<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr">сб, 28 апр. 2018 г., 9:07 Andrei Vagin <<a href="mailto:avagin@virtuozzo.com">avagin@virtuozzo.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A set of images from criu dump can be used as a previous point, when we<br>
are doing snapshots. In this case, each point contains a full set of<br>
images.<br>
<br>
<a href="https://github.com/checkpoint-restore/criu/issues/479" rel="noreferrer noreferrer" target="_blank">https://github.com/checkpoint-restore/criu/issues/479</a><br>
<br>
Cc: Pavel Tikhomirov <<a href="mailto:ptikhomirov@virtuozzo.com" target="_blank" rel="noreferrer">ptikhomirov@virtuozzo.com</a>><br>
Signed-off-by: Andrei Vagin <<a href="mailto:avagin@virtuozzo.com" target="_blank" rel="noreferrer">avagin@virtuozzo.com</a>><br>
---<br>
criu/cr-dump.c | 7 ++++++-<br>
criu/image.c | 16 +++++++++++-----<br>
criu/include/crtools.h | 2 +-<br>
criu/mem.c | 12 ++++++------<br>
4 files changed, 24 insertions(+), 13 deletions(-)<br>
<br>
diff --git a/criu/cr-dump.c b/criu/cr-dump.c<br>
index 00b84feed..e75783f2f 100644<br>
--- a/criu/cr-dump.c<br>
+++ b/criu/cr-dump.c<br>
@@ -1577,7 +1577,9 @@ static int cr_pre_dump_finish(int ret)<br>
if (arch_set_thread_regs(root_item, false) < 0)<br>
goto err;<br>
<br>
- prepare_inventory_pre_dump(&he);<br>
+ if (invertory_save_uptime(&he))<br>
+ goto err;<br>
+<br>
pstree_switch_state(root_item, TASK_ALIVE);<br>
<br>
timing_stop(TIME_FROZEN);<br>
@@ -2008,6 +2010,9 @@ int cr_dump_tasks(pid_t pid)<br>
if (ret)<br>
goto err;<br>
<br>
+ if (invertory_save_uptime(&he))<br>
+ goto err;<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Maybe:</div><div dir="auto"><br></div><div dir="auto">ret = <span style="font-family:sans-serif">invertory_save_uptime(&he);</span></div><div dir="auto"><span style="font-family:sans-serif">if (ret)</span><br style="font-family:sans-serif"><span style="font-family:sans-serif"> goto err;</span><span style="font-family:sans-serif"><br></span></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><span style="font-family:sans-serif">Everything else is fine.</span></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
ret = write_img_inventory(&he);<br>
if (ret)<br>
goto err;<br>
diff --git a/criu/image.c b/criu/image.c<br>
index fcdc081c1..108471b36 100644<br>
--- a/criu/image.c<br>
+++ b/criu/image.c<br>
@@ -113,14 +113,20 @@ int write_img_inventory(InventoryEntry *he)<br>
return 0;<br>
}<br>
<br>
-void prepare_inventory_pre_dump(InventoryEntry *he)<br>
+int invertory_save_uptime(InventoryEntry *he)<br>
{<br>
- pr_info("Perparing image inventory for pre-dump (version %u)\n", CRTOOLS_IMAGES_V1);<br>
+ if (!opts.track_mem)<br>
+ return 0;</blockquote></div></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
- he->img_version = CRTOOLS_IMAGES_V1_1;<br>
+ /*<br>
+ * dump_uptime is used to detect whether a process was handled<br>
+ * before or it is a new process with the same pid.<br>
+ */<br>
+ if (parse_uptime(&he->dump_uptime))<br>
+ return -1;<br>
<br>
- if (!parse_uptime(&he->dump_uptime))<br>
- he->has_dump_uptime = true;<br>
+ he->has_dump_uptime = true;<br>
+ return 0;<br>
}<br>
<br>
InventoryEntry *get_parent_inventory(void)<br>
diff --git a/criu/include/crtools.h b/criu/include/crtools.h<br>
index 2c21e822a..7b2dc4523 100644<br>
--- a/criu/include/crtools.h<br>
+++ b/criu/include/crtools.h<br>
@@ -12,7 +12,7 @@<br>
<br>
extern int check_img_inventory(void);<br>
extern int write_img_inventory(InventoryEntry *he);<br>
-extern void prepare_inventory_pre_dump(InventoryEntry *he);<br>
+extern int invertory_save_uptime(InventoryEntry *he);<br>
extern InventoryEntry *get_parent_inventory(void);<br>
extern int prepare_inventory(InventoryEntry *he);<br>
struct pprep_head {<br>
diff --git a/criu/mem.c b/criu/mem.c<br>
index dc67fc50d..289f36297 100644<br>
--- a/criu/mem.c<br>
+++ b/criu/mem.c<br>
@@ -299,6 +299,12 @@ static int detect_pid_reuse(struct pstree_item *item,<br>
unsigned long long tps; /* ticks per second */<br>
int ret;<br>
<br>
+ if (!parent_ie) {<br>
+ pr_err("Pid-reuse detection failed: no parent inventory, " \<br>
+ "check warnings in get_parent_stats\n");<br>
+ return -1;<br>
+ }<br>
+<br>
tps = sysconf(_SC_CLK_TCK);<br>
if (tps == -1) {<br>
pr_perror("Failed to get clock ticks via sysconf");<br>
@@ -312,12 +318,6 @@ static int detect_pid_reuse(struct pstree_item *item,<br>
return -1;<br>
}<br>
<br>
- if (!parent_ie) {<br>
- pr_err("Pid-reuse detection failed: no parent inventory, " \<br>
- "check warnings in get_parent_stats\n");<br>
- return -1;<br>
- }<br>
-<br>
dump_ticks = parent_ie->dump_uptime/(USEC_PER_SEC/tps);<br>
<br>
if (pps->start_time >= dump_ticks) {<br>
-- <br>
2.14.3<br>
<br>
_______________________________________________<br>
CRIU mailing list<br>
<a href="mailto:CRIU@openvz.org" target="_blank" rel="noreferrer">CRIU@openvz.org</a><br>
<a href="https://lists.openvz.org/mailman/listinfo/criu" rel="noreferrer noreferrer" target="_blank">https://lists.openvz.org/mailman/listinfo/criu</a><br>
</blockquote></div></div></div>