Hello community, here is the log from the commit of package criu for openSUSE:Factory checked in at 2014-01-28 15:37:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/criu (Old) and /work/SRC/openSUSE:Factory/.criu.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "criu" Changes: -------- --- /work/SRC/openSUSE:Factory/criu/criu.changes 2014-01-23 15:41:05.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.criu.new/criu.changes 2014-01-28 15:38:00.000000000 +0100 @@ -1,0 +2,27 @@ +Tue Jan 28 12:42:34 CET 2014 - [email protected] + +- Update to version 1.1: BUGs fixed, + * Errors from memory dumping are not handled resulting in + corrupted dumps + * EOF detection in stacked images is done with error + * Stacked images don't work on non-shared FS (missing pagemap-s) + +------------------------------------------------------------------- +Tue Jan 21 12:23:27 CET 2014 - [email protected] + +- Update to version 1.1-rc2: Bugs fixed, + * Crash in criu check + * RPC check always fail on 3.11 kernel + * Failed fork() didn't abort restore + * Dump fail not reported via RPC + * RPC client disconnect wasn't handled + * Page server could connect to self for writing images + * Hang on pre-dumping task livig in net-namespace + * VDSO page mis-handle on pre-dump + * FPU state loss on pre-dump + * Memory tracking turns ON w/o request + * Various fixes (and improvements) in build system +- Fix missing struct ptrace_peeksiginfo_args on FACTORY: + always-define-ptrace_peeksiginfo_args.diff + +------------------------------------------------------------------- Old: ---- criu-1.1-rc1.tar.bz2 New: ---- always-define-ptrace_peeksiginfo_args.diff criu-1.1.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ criu.spec ++++++ --- /var/tmp/diff_new_pack.KvuaVe/_old 2014-01-28 15:38:01.000000000 +0100 +++ /var/tmp/diff_new_pack.KvuaVe/_new 2014-01-28 15:38:01.000000000 +0100 @@ -16,9 +16,8 @@ # -%define package_version 1.1-rc1 Name: criu -Version: 1.0.99.1 +Version: 1.1 Release: 0 Summary: Checkpoint/Restore In Userspace Tools License: GPL-2.0 @@ -28,7 +27,8 @@ BuildRequires: protobuf-c BuildRequires: xmlto BuildRequires: pkgconfig(systemd) -Source0: http://download.openvz.org/criu/criu-%{package_version}.tar.bz2 +Source0: http://download.openvz.org/criu/criu-%{version}.tar.bz2 +Patch1: always-define-ptrace_peeksiginfo_args.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build ExclusiveArch: x86_64 @@ -40,7 +40,10 @@ the point it was frozen at. %prep -%setup -q -n %{name}-%{package_version} +%setup -q -n %{name}-%{version} +%if 0%{suse_version} > 1310 +%patch1 -p1 +%endif %build export CFLAGS="%optflags" ++++++ always-define-ptrace_peeksiginfo_args.diff ++++++ struct ptrace_peeksiginfo_args is defined in linux/ptrace.h but not in sys/ptrace.h. --- include/ptrace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/include/ptrace.h +++ b/include/ptrace.h @@ -19,6 +19,8 @@ #ifndef PTRACE_PEEKSIGINFO #define PTRACE_PEEKSIGINFO 0x4209 +#endif + struct ptrace_peeksiginfo_args { __u64 off; /* from which siginfo to start */ __u32 flags; @@ -27,7 +29,6 @@ struct ptrace_peeksiginfo_args { /* Read signals from a shared (process wide) queue */ #define PTRACE_PEEKSIGINFO_SHARED (1 << 0) -#endif #ifndef PTRACE_GETREGSET # define PTRACE_GETREGSET 0x4204 ++++++ criu-1.1-rc1.tar.bz2 -> criu-1.1.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/Documentation/.gitignore new/criu-1.1/Documentation/.gitignore --- old/criu-1.1-rc1/Documentation/.gitignore 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/Documentation/.gitignore 2014-01-28 10:04:03.000000000 +0100 @@ -1,3 +1,5 @@ *.xml *.html *.[1-8] +*.pdf +*.ps diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/Documentation/Makefile new/criu-1.1/Documentation/Makefile --- old/criu-1.1-rc1/Documentation/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/Documentation/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -5,20 +5,43 @@ XMLTO := xmlto SRC += criu.txt +XMLS := $(patsubst %.txt,%.xml,$(SRC)) MANS := $(patsubst %.txt,%.8,$(SRC)) MAN8DIR := $(MANDIR)/man8 -all: $(MANS) +GROFF=groff +PAPER=$(shell paperconf 2>/dev/null || echo letter) +GROFF_OPTS := -Tps -t -dpaper=$(PAPER) -P-p$(PAPER) \ + -man -msafer -rC1 -rD1 -rS11 +PSS := $(MANS:%.8=%.ps) +PDFS := $(MANS:%.8=%.pdf) + +all: check $(MANS) +ps: $(PSS) +pdf: $(PDFS) +.PHONY: all ps pdf check + +check: + $(Q) for B in $(ASCIIDOC) $(A2X) $(XMLTO); do \ + $$B --version > /dev/null || exit 1; \ + done %.8: %.txt $(E) " GEN " $@ $(Q) $(ASCIIDOC) -b docbook -d manpage -o $(patsubst %.8,%.xml,$@) $< $(Q) $(XMLTO) man --skip-validation $(patsubst %.8,%.xml,$@) 2>/dev/null +%.ps: %.8 + $(E) " GEN " $@ + $(Q) $(GROFF) $(GROFF_OPTS) $^ > $@ + +%.pdf: %.ps + $(E) " GEN " $@ + $(Q) ps2pdf $< $@ + clean: $(E) " CLEAN " - $(Q) rm -f ./*.xml - $(Q) rm -f ./*.8 + $(Q) rm -f $(XMLS) $(MANS) $(PSS) $(PDFS) install: $(MANS) $(E) " INSTALL " $(MANS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/Documentation/criu.txt new/criu-1.1/Documentation/criu.txt --- old/criu-1.1-rc1/Documentation/criu.txt 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/Documentation/criu.txt 2014-01-28 10:04:03.000000000 +0100 @@ -106,11 +106,14 @@ *-o*, *--log-file* 'file':: Write logging messages to 'file'. -*-v* 'num':: - Set logging level to 'num'. Valid arguments are: - * *0* - (silent, error messages only); - * *1* - informative (default); - * *2* - debug messages. +*-v*['num'|*v*...]:: + Set logging level to 'num'. The higer the level, the more output + is produced. Either numeric values or multiple *v* can be used. + The following levels are available: + * *-v1*, *-v* - only messages and errors; + * *-v2*, *-vv* - also warnings (default level); + * *-v3*, *-vvv* - also information messages and timestamps; + * *-v4*, *-vvvv* - lots of debug. *--log-pid*:: Write separate logging files per each pid. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/Makefile new/criu-1.1/Makefile --- old/criu-1.1-rc1/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -1,5 +1,5 @@ VERSION_MAJOR := 1 -VERSION_MINOR := 1-rc1 +VERSION_MINOR := 1 VERSION_SUBLEVEL := VERSION_EXTRA := VERSION_NAME := diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/README new/criu-1.1/README --- old/criu-1.1-rc1/README 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/README 2014-01-28 10:04:03.000000000 +0100 @@ -1,15 +1,16 @@ criu ==== -An utility to checkpoint/restore tasks. +An utility to checkpoint/restore tasks. Using this tool, you can +freeze a running application (or part of it) and checkpoint it to +a hard drive as a collection of files. You can then use the files +to restore and run the application from the point it was frozen +at. The distinctive feature of the CRIU project is that it is +mainly implemented in user space. -Some code snippets are borrowed from +The project home is at http://criu.org - - Linux kernel (http://kernel.org/) - - git (http://git-scm.com/) - - kvm-tools (https://github.com/penberg/linux-kvm) - - ptrace-parasite (https://code.google.com/p/ptrace-parasite/) - -Many thanks to these projects. - -Licensed under GPLv2 (http://www.gnu.org/licenses/gpl-2.0.txt) +Pages worth starting with are +* Kernel configuration, compilation, etc: http://criu.org/Installation +* A simple example of usage: http://criu.org/Simple_loop +* More sophisticated example with graphical app: http://criu.org/VNC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/cr-check.c new/criu-1.1/cr-check.c --- old/criu-1.1-rc1/cr-check.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/cr-check.c 2014-01-28 10:04:03.000000000 +0100 @@ -541,6 +541,11 @@ return -1; } + if (collect_mount_info(getpid())) { + pr_err("Can't collect mount infos\n"); + return -1; + } + ret |= check_map_files(); ret |= check_sock_diag(); ret |= check_ns_last_pid(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/cr-dedup.c new/criu-1.1/cr-dedup.c --- old/criu-1.1-rc1/cr-dedup.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/cr-dedup.c 2014-01-28 10:04:03.000000000 +0100 @@ -114,14 +114,14 @@ struct iovec piov; unsigned long piov_end; ret = seek_pagemap_page(pr, off, false); - if (ret == -1) { - if(off < pr->cvaddr) { - if(pr->cvaddr < iov_end) - off = pr->cvaddr; - else - return 0; - } else - return ret; + if (ret == -1) + return -1; + + if (ret == 0) { + if (off < pr->cvaddr && pr->cvaddr < iov_end) + off = pr->cvaddr; + else + return 0; } if (!pr->pe) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/cr-dump.c new/criu-1.1/cr-dump.c --- old/criu-1.1-rc1/cr-dump.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/cr-dump.c 2014-01-28 10:04:03.000000000 +0100 @@ -1334,6 +1334,12 @@ goto err_free; } + ret = parasite_fixup_vdso(parasite_ctl, pid, &vmas); + if (ret) { + pr_err("Can't fixup vdso VMAs (pid: %d)\n", pid); + goto err_cure; + } + ret = parasite_dump_misc_seized(parasite_ctl, &misc); if (ret) { pr_err("Can't dump misc (pid: %d)\n", pid); @@ -1417,7 +1423,7 @@ } ret = parse_posix_timers(pid, &proc_args); - if (ret < 0){ + if (ret < 0) { pr_err("Can't read posix timers file (pid: %d)\n", pid); goto err; } @@ -1602,6 +1608,12 @@ if (kerndat_init()) goto err; + if (cpu_init()) + goto err; + + if (vdso_init()) + goto err; + if (connect_to_page_server()) goto err; @@ -1633,6 +1645,10 @@ ret = page_xfer_dump_pages(&xfer, ctl->mem_pp, 0); xfer.close(&xfer); + + if (ret) + break; + timing_stop(TIME_MEMWRITE); destroy_page_pipe(ctl->mem_pp); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/cr-exec.c new/criu-1.1/cr-exec.c --- old/criu-1.1-rc1/cr-exec.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/cr-exec.c 2014-01-28 10:04:03.000000000 +0100 @@ -49,7 +49,7 @@ * @<size> -- ret-arg of size <size> */ - if ((opt[i][0] == '&') || (opt[i][0] == '@')){ + if ((opt[i][0] == '&') || (opt[i][0] == '@')) { int len; if (!r_mem) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/cr-restore.c new/criu-1.1/cr-restore.c --- old/criu-1.1-rc1/cr-restore.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/cr-restore.c 2014-01-28 10:04:03.000000000 +0100 @@ -947,6 +947,8 @@ } else ca.core = NULL; + ret = -1; + ca.item = item; ca.clone_flags = item->rst->clone_flags; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/cr-service.c new/criu-1.1/cr-service.c --- old/criu-1.1-rc1/cr-service.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/cr-service.c 2014-01-28 10:04:03.000000000 +0100 @@ -35,6 +35,12 @@ return -1; } + if (len == 0) { + pr_info("Client exited unexpectedly\n"); + errno = ECONNRESET; + return -1; + } + *msg = criu_req__unpack(NULL, len, buf); if (!*msg) { pr_perror("Failed unpacking request"); @@ -186,7 +192,7 @@ success = true; exit: - if (req->leave_running || !self_dump) { + if (req->leave_running || !self_dump || !success) { if (send_criu_dump_resp(sk, success, false) == -1) { pr_perror("Can't send response"); success = false; @@ -233,6 +239,9 @@ resp.type = CRIU_REQ_TYPE__CHECK; + /* Check only minimal kernel support */ + opts.check_ms_kernel = true; + if (!cr_check()) resp.success = true; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/cr-show.c new/criu-1.1/cr-show.c --- old/criu-1.1-rc1/cr-show.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/cr-show.c 2014-01-28 10:04:03.000000000 +0100 @@ -478,7 +478,7 @@ PstreeEntry *pe; ret = pb_read_one_eof(fd, &pe, PB_PSTREE); - if (ret <= 0){ + if (ret <= 0) { close(fd); return ret; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/crtools.c new/criu-1.1/crtools.c --- old/criu-1.1-rc1/crtools.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/crtools.c 2014-01-28 10:04:03.000000000 +0100 @@ -71,7 +71,7 @@ return 0; bad_ns: - pr_err("Unknown namespace '%s'\n", ptr); + pr_msg("Error: unknown namespace: %s\n", ptr); return -1; } @@ -79,10 +79,50 @@ { pid_t pid = 0, tree_id = 0; int ret = -1; + bool usage_error = true; int opt, idx; int log_level = 0; char *imgs_dir = "."; char *work_dir = NULL; + static const char short_opts[] = "dsRf:F:t:p:hcD:o:n:v::xVr:jlW:L:"; + static struct option long_opts[] = { + { "tree", required_argument, 0, 't' }, + { "pid", required_argument, 0, 'p' }, + { "leave-stopped", no_argument, 0, 's' }, + { "leave-running", no_argument, 0, 'R' }, + { "restore-detached", no_argument, 0, 'd' }, + { "daemon", no_argument, 0, 'd' }, + { "contents", no_argument, 0, 'c' }, + { "file", required_argument, 0, 'f' }, + { "fields", required_argument, 0, 'F' }, + { "images-dir", required_argument, 0, 'D' }, + { "work-dir", required_argument, 0, 'W' }, + { "log-file", required_argument, 0, 'o' }, + { "namespaces", required_argument, 0, 'n' }, + { "root", required_argument, 0, 'r' }, + { USK_EXT_PARAM, no_argument, 0, 'x' }, + { "help", no_argument, 0, 'h' }, + { SK_EST_PARAM, no_argument, 0, 42 }, + { "close", required_argument, 0, 43 }, + { "log-pid", no_argument, 0, 44}, + { "version", no_argument, 0, 'V'}, + { "evasive-devices", no_argument, 0, 45}, + { "pidfile", required_argument, 0, 46}, + { "veth-pair", required_argument, 0, 47}, + { "action-script", required_argument, 0, 49}, + { LREMAP_PARAM, no_argument, 0, 41}, + { OPT_SHELL_JOB, no_argument, 0, 'j'}, + { OPT_FILE_LOCKS, no_argument, 0, 'l'}, + { "page-server", no_argument, 0, 50}, + { "address", required_argument, 0, 51}, + { "port", required_argument, 0, 52}, + { "prev-images-dir", required_argument, 0, 53}, + { "ms", no_argument, 0, 54}, + { "track-mem", no_argument, 0, 55}, + { "auto-dedup", no_argument, 0, 56}, + { "libdir", required_argument, 0, 'L'}, + { }, + }; BUILD_BUG_ON(PAGE_SIZE != PAGE_IMAGE_SIZE); @@ -98,46 +138,7 @@ return 1; while (1) { - static const char short_opts[] = "dsRf:F:t:p:hcD:o:n:v::xVr:jlW:L:"; - static struct option long_opts[] = { - { "tree", required_argument, 0, 't' }, - { "pid", required_argument, 0, 'p' }, - { "leave-stopped", no_argument, 0, 's' }, - { "leave-running", no_argument, 0, 'R' }, - { "restore-detached", no_argument, 0, 'd' }, - { "daemon", no_argument, 0, 'd' }, - { "contents", no_argument, 0, 'c' }, - { "file", required_argument, 0, 'f' }, - { "fields", required_argument, 0, 'F' }, - { "images-dir", required_argument, 0, 'D' }, - { "work-dir", required_argument, 0, 'W' }, - { "log-file", required_argument, 0, 'o' }, - { "namespaces", required_argument, 0, 'n' }, - { "root", required_argument, 0, 'r' }, - { USK_EXT_PARAM, no_argument, 0, 'x' }, - { "help", no_argument, 0, 'h' }, - { SK_EST_PARAM, no_argument, 0, 42 }, - { "close", required_argument, 0, 43 }, - { "log-pid", no_argument, 0, 44}, - { "version", no_argument, 0, 'V'}, - { "evasive-devices", no_argument, 0, 45}, - { "pidfile", required_argument, 0, 46}, - { "veth-pair", required_argument, 0, 47}, - { "action-script", required_argument, 0, 49}, - { LREMAP_PARAM, no_argument, 0, 41}, - { OPT_SHELL_JOB, no_argument, 0, 'j'}, - { OPT_FILE_LOCKS, no_argument, 0, 'l'}, - { "page-server", no_argument, 0, 50}, - { "address", required_argument, 0, 51}, - { "port", required_argument, 0, 52}, - { "prev-images-dir", required_argument, 0, 53}, - { "ms", no_argument, 0, 54}, - { "track-mem", no_argument, 0, 55}, - { "auto-dedup", no_argument, 0, 56}, - { "libdir", required_argument, 0, 'L'}, - { }, - }; - + idx = -1; opt = getopt_long(argc, argv, short_opts, long_opts, &idx); if (opt == -1) break; @@ -154,9 +155,13 @@ break; case 'p': pid = atoi(optarg); + if (pid <= 0) + goto bad_arg; break; case 't': tree_id = atoi(optarg); + if (tree_id <= 0) + goto bad_arg; break; case 'c': opts.show_pages_content = true; @@ -184,7 +189,7 @@ break; case 'n': if (parse_ns_string(optarg)) - return 1; + goto bad_arg; break; case 'v': if (optarg) { @@ -231,8 +236,7 @@ n->outside = strchr(optarg, '='); if (n->outside == NULL) { xfree(n); - pr_err("Invalid argument for --veth-pair\n"); - goto usage; + goto bad_arg; } *n->outside++ = '\0'; @@ -260,10 +264,8 @@ break; case 52: opts.ps_port = htons(atoi(optarg)); - if (!opts.ps_port) { - pr_err("Bad port\n"); - return 1; - } + if (!opts.ps_port) + goto bad_arg; break; case 'j': opts.shell_job = true; @@ -292,6 +294,8 @@ pr_msg("GitID: %s\n", CRIU_GITID); return 0; case 'h': + usage_error = false; + goto usage; default: goto usage; } @@ -300,16 +304,16 @@ if (work_dir == NULL) work_dir = imgs_dir; - if (optind >= argc) + if (optind >= argc) { + pr_msg("Error: command is required\n"); goto usage; + } /* We must not open imgs dir, if service is called */ if (strcmp(argv[optind], "service")) { ret = open_image_dir(imgs_dir); - if (ret < 0) { - pr_perror("Can't open imgs directory"); + if (ret < 0) return 1; - } } if (chdir(work_dir)) { @@ -377,7 +381,7 @@ if (!strcmp(argv[optind], "dedup")) return cr_dedup() != 0; - pr_msg("Unknown command \"%s\"\n", argv[optind]); + pr_msg("Error: unknown command: %s\n", argv[optind]); usage: pr_msg("\n" "Usage:\n" @@ -402,7 +406,7 @@ " dedup remove duplicates in memory dump\n" ); - if (argc < 2) { + if (usage_error) { pr_msg("\nTry -h|--help for more info\n"); return 1; } @@ -436,12 +440,11 @@ "* Logging:\n" " -o|--log-file FILE log file name\n" " --log-pid enable per-process logging to separate FILE.pid files\n" -" -v[NUM] set logging level:\n" -" -v0 - messages regardless of log level\n" -" -v1, -v - errors, when we are in trouble\n" -" -v2, -vv - warnings (default)\n" -" -v3, -vvv - informative, everything is fine\n" -" -v4, -vvvv - debug only\n" +" -v[NUM] set logging level (higher level means more output):\n" +" -v1|-v - only errors and messages\n" +" -v2|-vv - also warnings (default level)\n" +" -v3|-vvv - also information messages and timestamps\n" +" -v4|-vvvv - lots of debug\n" "\n" "* Memory dumping options:\n" " --track-mem turn on memory changes tracker in kernel\n" @@ -466,9 +469,18 @@ " --ms don't check not yet merged kernel features\n" ); - return 1; + return 0; opt_pid_missing: - pr_msg("No pid specified (-t option missing)\n"); + pr_msg("Error: pid not specified\n"); + return 1; + +bad_arg: + if (idx < 0) /* short option */ + pr_msg("Error: invalid argument for -%c: %s\n", + opt, optarg); + else /* long option */ + pr_msg("Error: invalid argument for --%s: %s\n", + long_opts[idx].name, optarg); return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/image.c new/criu-1.1/image.c --- old/criu-1.1-rc1/image.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/image.c 2014-01-28 10:04:03.000000000 +0100 @@ -71,7 +71,7 @@ crt.state = TASK_ALIVE; crt.pid.real = getpid(); - if (get_task_ids(&crt)){ + if (get_task_ids(&crt)) { close(fd); return -1; } @@ -244,26 +244,14 @@ fd = ret; if (opts.img_parent) { - int pfd; - ret = symlinkat(opts.img_parent, fd, CR_PARENT_LINK); - if (ret < 0) { + if (ret < 0 && errno != EEXIST) { pr_perror("Can't link parent snapshot"); goto err; } - - pfd = openat(fd, CR_PARENT_LINK, O_RDONLY); - if (pfd < 0) { - pr_perror("Can't open parent snapshot"); - goto err; - } - - ret = install_service_fd(PARENT_FD_OFF, pfd); - - close(pfd); } - return ret; + return 0; err: close_image_dir(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/include/list.h new/criu-1.1/include/list.h --- old/criu-1.1-rc1/include/list.h 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/include/list.h 2014-01-28 10:04:03.000000000 +0100 @@ -366,7 +366,7 @@ n->next = next; next->pprev = &n->next; - if(next->next) + if (next->next) next->next->pprev = &next->next; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/include/servicefd.h new/criu-1.1/include/servicefd.h --- old/criu-1.1-rc1/include/servicefd.h 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/include/servicefd.h 2014-01-28 10:04:03.000000000 +0100 @@ -11,7 +11,6 @@ PROC_FD_OFF, /* fd with /proc for all proc_ calls */ CTL_TTY_OFF, SELF_STDIN_OFF, - PARENT_FD_OFF, CR_PROC_FD_OFF, /* some other's proc fd. * For dump -- target ns' proc * For restore -- CRIU ns' proc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/kerndat.c new/criu-1.1/kerndat.c --- old/criu-1.1-rc1/kerndat.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/kerndat.c 2014-01-28 10:04:03.000000000 +0100 @@ -12,6 +12,7 @@ #include "compiler.h" #include "sysctl.h" #include "asm/types.h" +#include "cr_options.h" dev_t kerndat_shmem_dev; @@ -96,8 +97,13 @@ if (pmap & PME_SOFT_DIRTY) { pr_info("Dirty track supported on kernel\n"); kerndat_has_dirty_track = true; - } else + } else { pr_info("Dirty tracking support is OFF\n"); + if (opts.track_mem) { + pr_err("Tracking memory is not available\n"); + return -1; + } + } return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/log.c new/criu-1.1/log.c --- old/criu-1.1-rc1/log.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/log.c 2014-01-28 10:04:03.000000000 +0100 @@ -19,6 +19,8 @@ #include "servicefd.h" #define DEFAULT_LOGFD STDERR_FILENO +/* Enable timestamps if verbosity is increased from default */ +#define LOG_TIMESTAMP (DEFAULT_LOGLEVEL + 1) static unsigned int current_loglevel = DEFAULT_LOGLEVEL; @@ -27,8 +29,8 @@ static struct timeval start; /* - * Manual buf len as sprintf will _always_ put '\0' at the - * and, but we want a "constant" pid to be there on restore + * Manual buf len as sprintf will _always_ put '\0' at the end, + * but we want a "constant" pid to be there on restore */ #define TS_BUF_OFF 12 @@ -61,12 +63,21 @@ return fd < 0 ? DEFAULT_LOGFD : fd; } +static void reset_buf_off(void) +{ + if (current_loglevel >= LOG_TIMESTAMP) + /* reserve space for a timestamp */ + buf_off = TS_BUF_OFF; + else + buf_off = 0; +} + int log_init(const char *output) { int new_logfd, fd; gettimeofday(&start, NULL); - buf_off = TS_BUF_OFF; + reset_buf_off(); if (output) { new_logfd = open(output, O_CREAT|O_TRUNC|O_WRONLY|O_APPEND, 0600); @@ -102,8 +113,7 @@ * reset buf_off as this fn is called on each fork while * restoring process tree */ - - buf_off = TS_BUF_OFF; + reset_buf_off(); if (!opts.log_file_per_pid) { buf_off += snprintf(buffer + buf_off, PAGE_SIZE - buf_off, "%6d: ", getpid()); @@ -138,17 +148,17 @@ static void __print_on_level(unsigned int loglevel, const char *format, va_list params) { - int fd, size, ret, off; + int fd, size, ret, off = 0; if (unlikely(loglevel == LOG_MSG)) { fd = STDOUT_FILENO; - off = buf_off; + off = buf_off; /* skip dangling timestamp */ } else { if (loglevel > current_loglevel) return; fd = log_get_fd(); - print_ts(); - off = 0; + if (current_loglevel >= LOG_TIMESTAMP) + print_ts(); } size = vsnprintf(buffer + buf_off, PAGE_SIZE - buf_off, format, params); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/mem.c new/criu-1.1/mem.c --- old/criu-1.1-rc1/mem.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/mem.c 2014-01-28 10:04:03.000000000 +0100 @@ -19,35 +19,12 @@ #include "protobuf.h" #include "protobuf/pagemap.pb-c.h" -/* - * On dump we suck in the whole parent pagemap. Then, when observing - * a page with soft-dirty bit cleared (i.e. -- not modified) we check - * this map for this page presense. - * - * Since we scan the address space from vaddr 0 to 0xF..F, we can do - * linear search in parent pagemap and the rover variables helps us - * do it. - */ - -struct mem_snap_ctx { - unsigned long nr_iovs; - struct iovec *iovs; - unsigned long alloc; - unsigned long rover; -}; - -#define MEM_SNAP_BATCH 64 - static int task_reset_dirty_track(int pid) { if (!opts.track_mem) return 0; - if (!kerndat_has_dirty_track) { - pr_err("Kernel doesn't support dirty tracking. " - "No snapshot available.\n"); - return -1; - } + BUG_ON(!kerndat_has_dirty_track); return do_task_reset_dirty_track(pid); } @@ -75,87 +52,6 @@ return 0; } -static struct mem_snap_ctx *mem_snap_init(struct parasite_ctl *ctl) -{ - struct mem_snap_ctx *ctx; - int p_fd, pm_fd; - PagemapHead *h; - - p_fd = get_service_fd(PARENT_FD_OFF); - if (p_fd < 0) { - pr_debug("Will do full memory dump\n"); - return NULL; - } - - pm_fd = open_image_at(p_fd, CR_FD_PAGEMAP, O_RSTR, ctl->pid.virt); - if (pm_fd < 0) { - if (errno == ENOENT) - return NULL; - return ERR_PTR(pm_fd); - } - - ctx = xmalloc(sizeof(*ctx)); - if (!ctx) - goto err_cl; - - ctx->nr_iovs = 0; - ctx->alloc = MEM_SNAP_BATCH; - ctx->rover = 0; - ctx->iovs = xmalloc(MEM_SNAP_BATCH * sizeof(struct iovec)); - if (!ctx->iovs) - goto err_free; - - if (pb_read_one(pm_fd, &h, PB_PAGEMAP_HEAD) < 0) - goto err_freei; - - pagemap_head__free_unpacked(h, NULL); - - while (1) { - int ret; - PagemapEntry *pe; - - ret = pb_read_one_eof(pm_fd, &pe, PB_PAGEMAP); - if (ret == 0) - break; - if (ret < 0) - goto err_freei; - - ctx->iovs[ctx->nr_iovs].iov_base = decode_pointer(pe->vaddr); - ctx->iovs[ctx->nr_iovs].iov_len = pe->nr_pages * PAGE_SIZE; - ctx->nr_iovs++; - pagemap_entry__free_unpacked(pe, NULL); - - if (ctx->nr_iovs >= ctx->alloc) { - ctx->iovs = xrealloc(ctx->iovs, - (ctx->alloc + MEM_SNAP_BATCH) * sizeof(struct iovec)); - if (!ctx->iovs) - goto err_freei; - - ctx->alloc += MEM_SNAP_BATCH; - } - } - - pr_info("Collected parent snap of %lu entries\n", ctx->nr_iovs); - close(pm_fd); - return ctx; - -err_freei: - xfree(ctx->iovs); -err_free: - xfree(ctx); -err_cl: - close(pm_fd); - return ERR_PTR(-1); -} - -static void mem_snap_close(struct mem_snap_ctx *ctx) -{ - if (ctx) { - xfree(ctx->iovs); - xfree(ctx); - } -} - unsigned int dump_pages_args_size(struct vm_area_list *vmas) { /* @@ -184,38 +80,14 @@ return false; } -static int page_in_parent(unsigned long vaddr, u64 map, struct mem_snap_ctx *snap) +static inline bool page_in_parent(u64 pme) { /* - * Soft-dirty pages should be dumped here - */ - if (map & PME_SOFT_DIRTY) - return 0; - - /* - * Non soft-dirty should be present in parent map. - * Otherwise pagemap is screwed up. + * If we do memory tracking, but w/o parent images, + * then we have to dump all memory */ - while (1) { - struct iovec *iov; - - iov = &snap->iovs[snap->rover]; - if ((unsigned long)iov->iov_base > vaddr) - break; - - if ((unsigned long)iov->iov_base + iov->iov_len > vaddr) - return 1; - - snap->rover++; - if (snap->rover >= snap->nr_iovs) - break; - } - - pr_warn("Page %lx not in parent snap range (rover %lu).\n" - "Dumping one, but the pagemap is screwed up.\n", - vaddr, snap->rover); - return 0; + return opts.track_mem && opts.img_parent && !(pme & PME_SOFT_DIRTY); } /* @@ -227,8 +99,7 @@ * the memory contents is present in the pagent image set. */ -static int generate_iovs(struct vma_area *vma, int pagemap, struct page_pipe *pp, u64 *map, - struct mem_snap_ctx *snap) +static int generate_iovs(struct vma_area *vma, int pagemap, struct page_pipe *pp, u64 *map) { unsigned long pfn, nr_to_scan; unsigned long pages[2] = {}; @@ -255,7 +126,15 @@ continue; vaddr = vma->vma.start + pfn * PAGE_SIZE; - if (snap && page_in_parent(vaddr, map[pfn], snap)) { + + /* + * If we're doing incremental dump (parent images + * specified) and page is not soft-dirty -- we dump + * hole and expect the parent images to contain this + * page. The latter would be checked in page-xfer. + */ + + if (page_in_parent(map[pfn])) { ret = page_pipe_add_hole(pp, vaddr); pages[0]++; } else { @@ -315,7 +194,6 @@ struct page_pipe_buf *ppb; struct vma_area *vma_area; int ret = -1; - struct mem_snap_ctx *snap; pr_info("\n"); pr_info("Dumping pages (type: %d pid: %d)\n", CR_FD_PAGES, ctl->pid.real); @@ -330,13 +208,9 @@ * Step 0 -- prepare */ - snap = mem_snap_init(ctl); - if (IS_ERR(snap)) - goto out; - map = xmalloc(vma_area_list->longest * sizeof(*map)); if (!map) - goto out_snap; + goto out; ret = pagemap = open_proc(ctl->pid.real, "pagemap"); if (ret < 0) @@ -355,7 +229,7 @@ if (!privately_dump_vma(vma_area)) continue; - ret = generate_iovs(vma_area, pagemap, pp, map, snap); + ret = generate_iovs(vma_area, pagemap, pp, map); if (ret < 0) goto out_pp; } @@ -405,6 +279,8 @@ goto out_pp; ret = page_xfer_dump_pages(&xfer, pp, 0); + if (ret < 0) + goto out_pp; xfer.close(&xfer); timing_stop(TIME_MEMWRITE); @@ -422,8 +298,6 @@ close(pagemap); out_free: xfree(map); -out_snap: - mem_snap_close(snap); out: pr_info("----------------------------------------\n"); return ret; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/mount.c new/criu-1.1/mount.c --- old/criu-1.1-rc1/mount.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/mount.c 2014-01-28 10:04:03.000000000 +0100 @@ -1507,7 +1507,7 @@ pfd = open_pid_proc(pid); ret = readlinkat(pfd, "root", path, sizeof(path) - 1); - if (ret < 0){ + if (ret < 0) { close_pid_proc(); return ret; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/page-read.c new/criu-1.1/page-read.c --- old/criu-1.1-rc1/page-read.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/page-read.c 2014-01-28 10:04:03.000000000 +0100 @@ -103,9 +103,9 @@ if (vaddr < pr->cvaddr) { if (warn) - pr_err("Missing %lu in parent pagemap, current iov: base=%lu,len=%zu\n", + pr_err("Missing %lu in parent pagemap, current iov: base=%lx,len=%zu\n", vaddr, (unsigned long)iov.iov_base, iov.iov_len); - return -1; + return 0; } iov_end = (unsigned long)iov.iov_base + iov.iov_len; @@ -115,13 +115,13 @@ new_pagemap: ret = get_pagemap(pr, &iov); if (ret <= 0) - return -1; + return ret; continue; } skip_pagemap_pages(pr, vaddr - pr->cvaddr); - return 0; + return 1; } } @@ -132,8 +132,8 @@ if (pr->pe->in_parent) { pr_debug("\tpr%u Read page %lx from parent\n", pr->id, vaddr); ret = seek_pagemap_page(pr->parent, vaddr, true); - if (ret == -1) - return ret; + if (ret <= 0) + return -1; ret = read_pagemap_page(pr->parent, vaddr, buf); if (ret == -1) return ret; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/page-xfer.c new/criu-1.1/page-xfer.c --- old/criu-1.1-rc1/page-xfer.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/page-xfer.c 2014-01-28 10:04:03.000000000 +0100 @@ -21,6 +21,8 @@ u64 dst_id; }; +static int open_page_local_xfer(struct page_xfer *xfer, int fd_type, long id); + #define PS_IOV_ADD 1 #define PS_IOV_HOLE 2 #define PS_IOV_OPEN 3 @@ -73,7 +75,7 @@ page_server_close(); - if (open_page_xfer(&cxfer.loc_xfer, type, id)) + if (open_page_local_xfer(&cxfer.loc_xfer, type, id)) return -1; cxfer.dst_id = pi->dst_id; @@ -215,7 +217,7 @@ } if (!flushed) { - pr_err("The data were not flushed"); + pr_err("The data were not flushed\n"); ret = -1; } @@ -466,10 +468,63 @@ return 0; } +static int check_pagehole_in_parent(struct page_read *p, struct iovec *iov) +{ + int ret; + unsigned long off, end; + + /* + * Try to find pagemap entry in parent, from which + * the data will be read on restore. + * + * This is the optimized version of the page-by-page + * read_pagemap_page routine. + */ + + pr_debug("Checking %p/%zu hole\n", iov->iov_base, iov->iov_len); + off = (unsigned long)iov->iov_base; + end = off + iov->iov_len; + while (1) { + struct iovec piov; + unsigned long pend; + + ret = seek_pagemap_page(p, off, true); + if (ret <= 0 || !p->pe) + return -1; + + pagemap2iovec(p->pe, &piov); + pr_debug("\tFound %p/%zu\n", piov.iov_base, piov.iov_len); + + /* + * The pagemap entry in parent may heppen to be + * shorter, than the hole we write. In this case + * we should go ahead and check the remainder. + */ + + pend = (unsigned long)piov.iov_base + piov.iov_len; + if (end <= pend) + return 0; + + pr_debug("\t\tcontinue on %lx\n", pend); + off = pend; + } +} + static int write_pagehole_loc(struct page_xfer *xfer, struct iovec *iov) { PagemapEntry pe = PAGEMAP_ENTRY__INIT; + if (xfer->parent != NULL) { + int ret; + + ret = check_pagehole_in_parent(xfer->parent, iov); + if (ret) { + pr_err("Hole %p/%zu not found in parent\n", + iov->iov_base, iov->iov_len); + return -1; + } + } + pe.vaddr = encode_pointer(iov->iov_base); pe.nr_pages = iov->iov_len / PAGE_SIZE; pe.has_in_parent = true; @@ -555,9 +610,17 @@ return -1; } - if (opts.auto_dedup && !opts.use_page_server) { + /* + * Open page-read for parent images (if it exists). It will + * be used for two things: + * 1) when writing a page, those from parent will be dedup-ed + * 2) when writing a hole, the respective place would be checked + * to exist in parent (either pagemap or hole) + */ + { int ret; int pfd; + pfd = openat(get_service_fd(IMG_FD_OFF), CR_PARENT_LINK, O_RDONLY); if (pfd < 0 && errno == ENOENT) goto out; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/parasite-syscall.c new/criu-1.1/parasite-syscall.c --- old/criu-1.1-rc1/parasite-syscall.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/parasite-syscall.c 2014-01-28 10:04:03.000000000 +0100 @@ -445,12 +445,9 @@ if (ssock == -1) { int rst = -1; - if (current_ns_mask & CLONE_NEWNET) { - pr_info("Switching to %d's net for tsock creation\n", pid); - - if (switch_ns(pid, &net_ns_desc, &rst)) - return -1; - } + pr_info("Switching to %d's net for tsock creation\n", pid); + if (switch_ns(pid, &net_ns_desc, &rst)) + return -1; ssock = socket(PF_UNIX, SOCK_SEQPACKET, 0); if (ssock < 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/pie/parasite.c new/criu-1.1/pie/parasite.c --- old/criu-1.1-rc1/pie/parasite.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/pie/parasite.c 2014-01-28 10:04:03.000000000 +0100 @@ -72,7 +72,7 @@ SPLICE_F_GIFT | SPLICE_F_NONBLOCK); if (ret != PAGE_SIZE * args->nr_pages) { sys_close(p); - pr_err("Can't splice pages to pipe (%d/%d)", ret, args->nr_pages); + pr_err("Can't splice pages to pipe (%d/%d)\n", ret, args->nr_pages); return -1; } @@ -121,7 +121,7 @@ int i; int ret = 0; - for(i = 0; i < args->timer_n; i++){ + for(i = 0; i < args->timer_n; i++) { ret = sys_timer_gettime(args->timer[i].it_id, &args->timer[i].val); if (ret < 0) { pr_err("sys_timer_gettime failed (%d)\n", ret); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/plugin.c new/criu-1.1/plugin.c --- old/criu-1.1-rc1/plugin.c 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/plugin.c 2014-01-28 10:04:03.000000000 +0100 @@ -13,15 +13,15 @@ struct cr_plugin_entry { union { - cr_plugin_fini_t *cr_fini; + cr_plugin_fini_t *cr_fini; - cr_plugin_dump_unix_sk_t *cr_plugin_dump_unix_sk; - cr_plugin_restore_unix_sk_t *cr_plugin_restore_unix_sk; - cr_plugin_dump_file_t *cr_plugin_dump_file; - cr_plugin_restore_file_t *cr_plugin_restore_file; - cr_plugin_dump_ext_mount_t *cr_plugin_dump_ext_mount; - cr_plugin_restore_ext_mount_t *cr_plugin_restore_ext_mount; - cr_plugin_dump_ext_link_t *cr_plugin_dump_ext_link; + cr_plugin_dump_unix_sk_t *cr_plugin_dump_unix_sk; + cr_plugin_restore_unix_sk_t *cr_plugin_restore_unix_sk; + cr_plugin_dump_file_t *cr_plugin_dump_file; + cr_plugin_restore_file_t *cr_plugin_restore_file; + cr_plugin_dump_ext_mount_t *cr_plugin_dump_ext_mount; + cr_plugin_restore_ext_mount_t *cr_plugin_restore_ext_mount; + cr_plugin_dump_ext_link_t *cr_plugin_dump_ext_link; }; struct cr_plugin_entry *next; @@ -47,15 +47,14 @@ name = dlsym(h, #name); \ if (name) { \ struct cr_plugin_entry *__ce; \ - __ce = xmalloc(sizeof(struct cr_plugin_entry)); \ + __ce = xmalloc(sizeof(*__ce)); \ if (__ce == NULL) \ goto nomem; \ __ce->name = name; \ __ce->next = cr_plugins.name; \ cr_plugins.name = __ce; \ } \ - } while (0); \ - + } while (0) #define run_plugin_funcs(name, ...) ({ \ struct cr_plugin_entry *__ce = cr_plugins.name; \ @@ -135,7 +134,7 @@ ce = NULL; f_fini = dlsym(h, "cr_plugin_fini"); if (f_fini) { - ce = xmalloc(sizeof(struct cr_plugin_entry)); + ce = xmalloc(sizeof(*ce)); if (ce == NULL) goto nomem; ce->cr_fini = f_fini; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/scripts/Makefile.build new/criu-1.1/scripts/Makefile.build --- old/criu-1.1-rc1/scripts/Makefile.build 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/scripts/Makefile.build 2014-01-28 10:04:03.000000000 +0100 @@ -230,7 +230,7 @@ .PHONY: all clean all: $(_all) - @echo > /dev/null + @true clean: $(E) " CLEANUP " $(obj) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/scripts/Makefile.rules new/criu-1.1/scripts/Makefile.rules --- old/criu-1.1-rc1/scripts/Makefile.rules 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/scripts/Makefile.rules 2014-01-28 10:04:03.000000000 +0100 @@ -49,4 +49,4 @@ ## together with .SUFFIXES not cleaned, this ## will slow down the build procedure scripts/Makefile.rules:: - @echo > /dev/null + @true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/scripts/Makefile.version new/criu-1.1/scripts/Makefile.version --- old/criu-1.1-rc1/scripts/Makefile.version 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/scripts/Makefile.version 2014-01-28 10:04:03.000000000 +0100 @@ -22,4 +22,4 @@ ## together with .SUFFIXES not cleaned, this ## will slow down the build procedure scripts/Makefile.version:: - @echo > /dev/null + @true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/Makefile new/criu-1.1/test/Makefile --- old/criu-1.1-rc1/test/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -7,17 +7,21 @@ all: .FORCE $(MAKE) zdtm +.PHONY: all zdtm: .FORCE $(MAKE) zdtm_ns for t in $(shell echo "$(TST)" | tr ' ' '\n' | grep -Pv $(EXP)); do \ $(MAKE) $$t || break; \ done +.PHONY: zdtm fault-injection: .FORCE $(MAKE) -C fault-injection +.PHONY: fault-injection zdtm_ns: $(shell echo "$(TST)" | tr ' ' '\n' | grep -P $(EXP)) $(TST): ./zdtm.sh ${ZDTM_ARGS} $(@) &> $(subst /,_,$@).log || \ { flock Makefile cat $(subst /,_,$@).log; exit 1; } +.PHONY: zdtm_ns diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/app-emu/job/Makefile new/criu-1.1/test/app-emu/job/Makefile --- old/criu-1.1-rc1/test/app-emu/job/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/app-emu/job/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -1,4 +1,5 @@ all: job +.PHONY: all %.o: %.c gcc -c $< -o $@ @@ -8,3 +9,4 @@ clean: rm -f *.o job +.PHONY: clean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/app-emu/make/Makefile new/criu-1.1/test/app-emu/make/Makefile --- old/criu-1.1-rc1/test/app-emu/make/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/app-emu/make/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -1,5 +1,6 @@ all: foo1.o foo2.o foo3.o foo4.o echo "Done" +.PHONY: all %.o: %.c gcc -c $< -o $@ @@ -9,3 +10,4 @@ clean: rm -f *.o +.PHONY: clean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/libcriu/Makefile new/criu-1.1/test/libcriu/Makefile --- old/criu-1.1-rc1/test/libcriu/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/libcriu/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -1,4 +1,5 @@ all: build/test +.PHONY: all build/test: build/test.o gcc $^ -L ../../lib -lcriu -o $@ @@ -8,3 +9,4 @@ clean: rm -rf build +.PHONY: clean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/mem-snap/run-predump-2.sh new/criu-1.1/test/mem-snap/run-predump-2.sh --- old/criu-1.1-rc1/test/mem-snap/run-predump-2.sh 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/mem-snap/run-predump-2.sh 2014-01-28 10:04:03.000000000 +0100 @@ -58,7 +58,7 @@ echo "Plain dump" mkdir "$IMGDIR/dump-2/plain/" -${CRIU} dump -D "$IMGDIR/dump-2/plain/" -o dump.log -t ${PID} -v4 --prev-images-dir=../pre/ || fail "Fail to dump" +${CRIU} dump -D "$IMGDIR/dump-2/plain/" -o dump.log -t ${PID} -v4 --prev-images-dir=../pre/ --track-mem || fail "Fail to dump" sleep 1 echo "Restore" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/mem-snap/run-predump.sh new/criu-1.1/test/mem-snap/run-predump.sh --- old/criu-1.1-rc1/test/mem-snap/run-predump.sh 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/mem-snap/run-predump.sh 2014-01-28 10:04:03.000000000 +0100 @@ -46,7 +46,7 @@ elif [ $SNAP -eq $NRSNAP ]; then # Last dump cmd="dump" - args="--prev-images-dir=../$((SNAP - 1))/" + args="--prev-images-dir=../$((SNAP - 1))/ --track-mem" else # Other pre-dumps cmd="pre-dump" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/mem-snap/run-snap-auto-dedup.sh new/criu-1.1/test/mem-snap/run-snap-auto-dedup.sh --- old/criu-1.1-rc1/test/mem-snap/run-snap-auto-dedup.sh 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/mem-snap/run-snap-auto-dedup.sh 2014-01-28 10:04:03.000000000 +0100 @@ -45,7 +45,7 @@ elif [ $SNAP -eq $NRSNAP ]; then # Last snapshot -- has parent, kill afterwards size_first=$(du -sh -BK dump/2/pages-*.img | grep -Eo '[0-9]+' | head -1) - args="--prev-images-dir=../$((SNAP - 1))/ --auto-dedup" + args="--prev-images-dir=../$((SNAP - 1))/ --track-mem --auto-dedup" else # Other snapshots -- have parent, keep running args="--prev-images-dir=../$((SNAP - 1))/ --track-mem -R" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/mem-snap/run-snap-dedup.sh new/criu-1.1/test/mem-snap/run-snap-dedup.sh --- old/criu-1.1-rc1/test/mem-snap/run-snap-dedup.sh 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/mem-snap/run-snap-dedup.sh 2014-01-28 10:04:03.000000000 +0100 @@ -44,7 +44,7 @@ args="--track-mem -R" elif [ $SNAP -eq $NRSNAP ]; then # Last snapshot -- has parent, kill afterwards - args="--prev-images-dir=../$((SNAP - 1))/" + args="--prev-images-dir=../$((SNAP - 1))/ --track-mem" else # Other snapshots -- have parent, keep running args="--prev-images-dir=../$((SNAP - 1))/ --track-mem -R" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/mem-snap/run-snap.sh new/criu-1.1/test/mem-snap/run-snap.sh --- old/criu-1.1-rc1/test/mem-snap/run-snap.sh 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/mem-snap/run-snap.sh 2014-01-28 10:04:03.000000000 +0100 @@ -44,7 +44,7 @@ args="--track-mem -R" elif [ $SNAP -eq $NRSNAP ]; then # Last snapshot -- has parent, kill afterwards - args="--prev-images-dir=../$((SNAP - 1))/" + args="--prev-images-dir=../$((SNAP - 1))/ --track-mem" else # Other snapshots -- have parent, keep running args="--prev-images-dir=../$((SNAP - 1))/ --track-mem -R" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/rpc/Makefile new/criu-1.1/test/rpc/Makefile --- old/criu-1.1-rc1/test/rpc/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/rpc/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -1,4 +1,5 @@ all: test-c rpc_pb2.py +.PHONY: all test-c: rpc.pb-c.o test.o gcc $^ -o $@ -lprotobuf-c @@ -14,3 +15,4 @@ clean: rm -rf build rpc.pb-c.o test.o test-c rpc.pb-c.c rpc.pb-c.h rpc_pb2.py +.PHONY: clean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/tcp/Makefile new/criu-1.1/test/tcp/Makefile --- old/criu-1.1-rc1/test/tcp/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/tcp/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -1,6 +1,8 @@ OBJS=cln srv all: $(OBJS) +.PHONY: all clean: rm -f $(OBJS) +.PHONY: clean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/zdtm/Makefile new/criu-1.1/test/zdtm/Makefile --- old/criu-1.1-rc1/test/zdtm/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/zdtm/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -1,8 +1,15 @@ SUBDIRS = lib live default: all +.PHONY: default lib live -.PHONY: default +lib: + $(MAKE) -C lib all +live: lib + $(MAKE) -C live all + +all: lib live + @true %: set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/zdtm/lib/Makefile new/criu-1.1/test/zdtm/lib/Makefile --- old/criu-1.1-rc1/test/zdtm/lib/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/zdtm/lib/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -14,10 +14,12 @@ $(DEPEND.c) $(OUTPUT_OPTION) $< all: $(LIB) - @echo > /dev/null + @true install: all +.PHONY: all install -$(LIB): $(LIB)(${LIBOBJ}) +$(LIB): $(LIBOBJ) + $(Q) ar rv $@ $^ clean: $(RM) -f $(LIBOBJ) $(LIB) *~ @@ -25,9 +27,12 @@ cleandep: $(RM) -f $(LIBDEP) +cleanout: + @true + realclean: clean cleandep -.PHONY: force clean cleandep cleanout realclean start check_start stop wait_stop +.PHONY: clean cleandep cleanout realclean ifeq ($(filter-out no-deps-targets, $(MAKECMDGOALS)),) -include $(LIBDEP) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/zdtm/live/Makefile new/criu-1.1/test/zdtm/live/Makefile --- old/criu-1.1-rc1/test/zdtm/live/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/zdtm/live/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -1,8 +1,7 @@ SUBDIRS = streaming transition static default: all - -.PHONY: default +.PHONY: default %: set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/zdtm/live/static/Makefile new/criu-1.1/test/zdtm/live/static/Makefile --- old/criu-1.1-rc1/test/zdtm/live/static/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/zdtm/live/static/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -178,6 +178,7 @@ all: $(TST) criu-rtc.so install: all +.PHONY: all install inotify_system_nodel.c: inotify_system.c ln -s inotify_system.c inotify_system_nodel.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/zdtm/live/streaming/Makefile new/criu-1.1/test/zdtm/live/streaming/Makefile --- old/criu-1.1-rc1/test/zdtm/live/streaming/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/zdtm/live/streaming/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -32,6 +32,7 @@ all: $(TST) install: all +.PHONY: all install $(TST_NOFILE:%=%.pid): %.pid: % $(<D)/$(<F) --pidfile=$@ --outfile=$<.out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/zdtm/live/transition/Makefile new/criu-1.1/test/zdtm/live/transition/Makefile --- old/criu-1.1-rc1/test/zdtm/live/transition/Makefile 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/zdtm/live/transition/Makefile 2014-01-28 10:04:03.000000000 +0100 @@ -29,6 +29,7 @@ all: $(TST) install: all +.PHONY: all install $(TST_NOFILE:%=%.pid): %.pid: % $(<D)/$(<F) --pidfile=$@ --outfile=$<.out diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/criu-1.1-rc1/test/zdtm.sh new/criu-1.1/test/zdtm.sh --- old/criu-1.1-rc1/test/zdtm.sh 2013-12-31 11:08:50.000000000 +0100 +++ new/criu-1.1/test/zdtm.sh 2014-01-28 10:04:03.000000000 +0100 @@ -175,7 +175,8 @@ SPECIFIED_NAME_USED=0 zdtm_sep() -{ +{ ( + set +x local msg=$1 [ -n "$msg" ] && msg=" $msg " awk -v m=${2:-=} -v "msg=$msg" ' @@ -186,7 +187,7 @@ gsub(/ /, m, sep); printf("%s%s%s\n",sep,msg,sep); }' < /dev/null -} +) } check_criu() { @@ -454,6 +455,7 @@ for i in `seq $ITERATIONS`; do local dump_only= local postdump= + local dump_cmd="dump" ddump=`readlink -fm dump/$tname/$PID/$i` DUMP_PATH=$ddump echo Dump $PID @@ -476,6 +478,7 @@ if [ "$i" -ne "$ITERATIONS" ]; then snapopt="$snapopt -R --track-mem" dump_only=1 + [ -n "$PRE_DUMP" ] && dump_cmd="pre-dump" fi [ -n "$snappdir" ] && snapopt="$snapopt --prev-images-dir=$snappdir" fi @@ -484,7 +487,7 @@ save_fds $PID $ddump/dump.fd save_maps $PID $ddump/dump.maps - setsid $CRIU_CPT dump $opts --file-locks --tcp-established $linkremap \ + setsid $CRIU_CPT $dump_cmd $opts --file-locks --tcp-established $linkremap \ -x --evasive-devices -D $ddump -o dump.log -v4 -t $PID $args $ARGS $snapopt $postdump retcode=$? @@ -668,6 +671,8 @@ -n : Batch test -r : Run test with specified name directly without match or check -v : Verbose mode + -P : Make pre-dump instead of dump on all iterations except the last one + -s : Make iterative snapshots. Only the last one will be checked. EOF } @@ -726,6 +731,19 @@ shift ;; -s) + if [ -n "$PRE_DUMP" ]; then + echo "-P and -s can not be used together" + exit 1 + fi + SNAPSHOT=1 + shift + ;; + -P) + if [ -n "$SNAPSHOT" ]; then + echo "-P and -s can not be used together" + exit 1 + fi + PRE_DUMP=1 SNAPSHOT=1 shift ;; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
