[CRIU] [PATCH 2/2] pagemap: Fault inject partial pages.img read
Pavel Emelyanov
xemul at virtuozzo.com
Fri Feb 3 05:23:17 PST 2017
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
criu/include/fault-injection.h | 1 +
criu/pagemap.c | 13 +++++++++++++
test/jenkins/criu-fault.sh | 2 ++
3 files changed, 16 insertions(+)
diff --git a/criu/include/fault-injection.h b/criu/include/fault-injection.h
index cf9859c..2b23f54 100644
--- a/criu/include/fault-injection.h
+++ b/criu/include/fault-injection.h
@@ -14,6 +14,7 @@ enum faults {
FI_CHECK_OPEN_HANDLE = 128,
FI_NO_MEMFD = 129,
FI_NO_BREAKPOINTS = 130,
+ FI_PARTIAL_PAGES = 131,
FI_MAX,
};
diff --git a/criu/pagemap.c b/criu/pagemap.c
index cb4c990..1fc9ba7 100644
--- a/criu/pagemap.c
+++ b/criu/pagemap.c
@@ -12,6 +12,7 @@
#include "pagemap.h"
#include "page-xfer.h"
+#include "fault-injection.h"
#include "xmalloc.h"
#include "protobuf.h"
#include "images/pagemap.pb-c.h"
@@ -494,6 +495,18 @@ static int process_async_reads(struct page_read *pr)
piov->to->iov_base, piov->to->iov_len);
more:
ret = preadv(fd, piov->to, piov->nr, piov->from);
+ if (fault_injected(FI_PARTIAL_PAGES)) {
+ /*
+ * We might have read everything, but for debug
+ * purposes let's try to force the advance_piov()
+ * and re-read tail.
+ */
+ if (ret > 0 && piov->nr >= 2) {
+ pr_debug("`- trim preadv %zu\n", ret);
+ ret /= 2;
+ }
+ }
+
if (ret != piov->end - piov->from) {
if (ret < 0) {
pr_err("Can't read async pr bytes (%zd / %ju read, %ju off, %d iovs)\n",
diff --git a/test/jenkins/criu-fault.sh b/test/jenkins/criu-fault.sh
index ab6c6c7..7ed2680 100755
--- a/test/jenkins/criu-fault.sh
+++ b/test/jenkins/criu-fault.sh
@@ -18,3 +18,5 @@ prep
./test/zdtm.py run -t zdtm/static/unlink_fstat03 --fault 6 --report report || fail
./test/zdtm.py run -t zdtm/static/env00 --fault 5 --keep-going --report report || fail
+./test/zdtm.py run -t zdtm/static/maps04 --fault 131 --keep-going --report report --pre 2:1 || fail
+./test/zdtm.py run -t zdtm/transition/maps008 --fault 131 --keep-going --report report --pre 2:1 || fail
--
2.1.4
More information about the CRIU
mailing list