[CRIU] crtools error: "can't splice to pipe"

Cyrill Gorcunov gorcunov at gmail.com
Mon Apr 28 23:13:37 PDT 2014


On Mon, Apr 28, 2014 at 06:36:10PM -0400, J F wrote:
>      There should be lines containing "[vdso]" string, mind to cat
>      /proc/pid/maps | grep vdso ?
> 
>    Here you go
>    ubuntu at ip-10-118-238-44:/proc/1289$ cat maps | grep vdso
>    7fff3b7fe000-7fff3b800000 r-xp 00000000 00:00 0 A  A  A  A  A  A  A  A  A 
>    A  A  A  A [vdso]

Could you please give the patch attached a shot

	git apply patch-name
	make
	run criu
-------------- next part --------------
diff --git a/pie/parasite.c b/pie/parasite.c
index 152186271361..18fd60e9b1cf 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -60,7 +60,7 @@ static int mprotect_vmas(struct parasite_dump_pages_args *args)
 
 static int dump_pages(struct parasite_dump_pages_args *args)
 {
-	int p, ret;
+	int p, ret, summary;
 	struct iovec *iovs;
 
 	p = recv_fd(tsock);
@@ -70,7 +70,30 @@ static int dump_pages(struct parasite_dump_pages_args *args)
 	iovs = pargs_iovs(args);
 	ret = sys_vmsplice(p, &iovs[args->off], args->nr_segs,
 				SPLICE_F_GIFT | SPLICE_F_NONBLOCK);
-	if (ret != PAGE_SIZE * args->nr_pages) {
+	pr_debug("\tSplicing %u segments (iovs %p off %u iov %p): ret %i\n",
+		 args->nr_segs, iovs, args->off, &iovs[args->off], ret);
+
+	summary = args->nr_pages * PAGE_SIZE;
+	while (ret > 0 && ret != summary) {
+		int left_pages = args->nr_pages - ret / PAGE_SIZE;
+		struct iovec *iov = &iovs[args->nr_segs - 1];
+		unsigned int nr_segs = 0;
+
+		summary = left_pages * PAGE_SIZE;
+		while (left_pages) {
+			left_pages -= iov->iov_len / PAGE_SIZE;
+			nr_segs++;
+			iov--;
+			BUG_ON(left_pages < 0);
+		}
+
+		ret = sys_vmsplice(p, &iov[1], nr_segs,
+				   SPLICE_F_GIFT | SPLICE_F_NONBLOCK);
+		pr_debug("\t\tContinue splicing %u segments (iov %p): ret %i\n",
+			 nr_segs, &iov[1], ret);
+	}
+
+	if (ret < 0) {
 		sys_close(p);
 		pr_err("Can't splice pages to pipe (%d/%d)\n", ret, args->nr_pages);
 		return -1;


More information about the CRIU mailing list