[criu-stable] pid-reuse: temporary use stat file from cwd if has no parent stats

Submitted by Pavel Tikhomirov on April 18, 2018, 7:47 a.m.

Details

Message ID 20180418074737.1166-1-ptikhomirov@virtuozzo.com
State New
Series "pid-reuse: temporary use stat file from cwd if has no parent stats"
Headers show

Commit Message

Pavel Tikhomirov April 18, 2018, 7:47 a.m.
We will eventually switch from stats file to inventory image, as the
former is a wrong place for dump_uptime anyway. But for now to reenable
pid-reuse detection for vz7 CT's we can read dump_uptime of a previous
pre-dump from stats file in cwd, as libvzctl sets for all iterations
same workdir, and as we read it before cr_*dump_finish (before we
overwrote it).

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

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
---
 criu/stats.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/stats.c b/criu/stats.c
index d344ad336..ff4167019 100644
--- a/criu/stats.c
+++ b/criu/stats.c
@@ -226,6 +226,12 @@  StatsEntry *get_parent_stats(void)
 	}
 
 	img = open_image_at(dir, CR_FD_STATS, O_RSTR, "dump");
+	if (!img)
+		/*
+		 * Temporary fallback to reading stats of a previous pre-dump
+		 * from a workdir. https://jira.sw.ru/browse/PSBM-82864
+		 */
+		img = open_image_at(AT_FDCWD, CR_FD_STATS, O_RSTR, "dump");
 	if (!img) {
 		pr_warn("Failed to open parent dump stats");
 		close(dir);