[CRIU] [PATCH] page-xfer: print error message if splice failed

Andrey Vagin avagin at openvz.org
Fri Jan 31 11:57:31 PST 2014


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 page-xfer.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/page-xfer.c b/page-xfer.c
index e56acfc..d0bf139 100644
--- a/page-xfer.c
+++ b/page-xfer.c
@@ -473,8 +473,16 @@ static int write_pagemap_loc(struct page_xfer *xfer,
 static int write_pages_loc(struct page_xfer *xfer,
 		int p, unsigned long len)
 {
-	if (splice(p, NULL, xfer->fd_pg, NULL, len, SPLICE_F_MOVE) != len)
+	unsigned long ret;
+	ret = splice(p, NULL, xfer->fd_pg, NULL, len, SPLICE_F_MOVE);
+	if (ret == -1) {
+		pr_perror("Unable to spice data");
 		return -1;
+	}
+	if (ret != len) {
+		pr_err("Only %lu of %lu bytes have been spliced\n", ret, len);
+		return -1;
+	}
 
 	return 0;
 }
-- 
1.8.3.1



More information about the CRIU mailing list