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

Cyrill Gorcunov gorcunov at gmail.com
Mon Apr 28 23:41:36 PDT 2014


On Tue, Apr 29, 2014 at 10:35:02AM +0400, Cyrill Gorcunov wrote:
> On Tue, Apr 29, 2014 at 10:13:37AM +0400, Cyrill Gorcunov wrote:
> > 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
> 
> Drop it please, I'll update.

Here it is (untested)
-------------- next part --------------
diff --git a/pie/parasite.c b/pie/parasite.c
index 152186271361..b3b9cfd869cc 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,34 @@ 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 = summary - (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--;
+			if (left_pages < 0) {
+				sys_close(p);
+				pr_err("left_pages %i\n", left_pages);
+				return -1;
+			}
+		}
+
+		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