[CRIU] [PATCH] pagemap: fix reading pages from socket for --remote case
Mike Rapoprt
rppt at linux.vnet.ibm.com
Sat Apr 22 06:37:34 PDT 2017
On April 22, 2017 6:50:39 AM GMT+03:00, Andrei Vagin <avagin at virtuozzo.com> wrote:
>On Fri, Apr 21, 2017 at 08:42:44PM -0700, Andrei Vagin wrote:
>> Rodrigo, could you review this patch?
>
>And there are other problems:
Let's move fix by fix :)
>[root at fc24 criu]# python test/zdtm.py run --remote -t zdtm/static/env00
>-f ns
>=== Run 1/1 ================ zdtm/static/env00
>
>========================= Run zdtm/static/env00 in ns
>==========================
>make[1]: Nothing to be done for 'default'.
>Start test
>make[1]: Nothing to be done for 'default'.
>./env00 --pidfile=env00.pid --outfile=env00.out --envname=ENV_00_TEST
>Adding image cache
>Adding image proxy
>Run criu dump
>Run criu restore
>=[log]=> dump/zdtm/static/env00/29/1/restore.log
>------------------------ grep Error ------------------------
>RTNETLINK answers: File exists
>(00.229999) 1: do_open_remote_image RDONLY path=route-9.img
>snapshot_id=dump/zdtm/static/env00/29/1
>(00.230344) 1: Running ip route restore
>Failed to restore: ftell: Illegal seek
>(00.233615) 1: Error (criu/util.c:712): exited, status=255
>(00.233662) 1: Error (criu/net.c:1479): IP tool failed on route
>restore
>(00.233695) 1: Error (criu/net.c:2153): Can't create net_ns
>(00.258027) Error (criu/cr-restore.c:1130): 105 killed by signal 9:
>Killed
>(00.258139) Error (criu/mount.c:2960): mnt: Can't remove the directory
>/tmp/.criu.mntns.s9sRwU: No such file or directory
>(00.258203) Error (criu/cr-restore.c:2059): Restoring FAILED.
>------------------------ ERROR OVER ------------------------
>################# Test zdtm/static/env00 FAIL at CRIU restore
>##################
>
>
>>
>> On Fri, Apr 21, 2017 at 06:25:54PM +0300, Mike Rapoport wrote:
>> > When --remote option is specified, read_local_page tries to pread
>from a
>> > socket, and fails with "Illegal seek" error.
>> > Restore single pread call for regular image files case and use read
>syscall
>> > instead of pread for the --remote case.
>> >
>> > Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
>> > ---
>> > criu/pagemap.c | 18 +++++++++++++-----
>> > 1 file changed, 13 insertions(+), 5 deletions(-)
>> >
>> > diff --git a/criu/pagemap.c b/criu/pagemap.c
>> > index 6c741b4..7d25c6f 100644
>> > --- a/criu/pagemap.c
>> > +++ b/criu/pagemap.c
>> > @@ -265,15 +265,23 @@ static int read_local_page(struct page_read
>*pr, unsigned long vaddr,
>> > return -1;
>> >
>> > pr_debug("\tpr%d-%u Read page from self %lx/%"PRIx64"\n",
>pr->pid, pr->id, pr->cvaddr, pr->pi_off);
>> > - while (1) {
>> > + if (!opts.remote) {
>> > ret = pread(fd, buf + curr, len - curr, pr->pi_off + curr);
>> > - if (ret < 1) {
>> > + if (ret != len) {
>> > pr_perror("Can't read mapping page %d", ret);
>> > return -1;
>> > }
>> > - curr += ret;
>> > - if (curr == len)
>> > - break;
>> > + } else {
>> > + while (1) {
>> > + ret = read(fd, buf + curr, len - curr);
>> > + if (ret < 0) {
>> > + pr_perror("Can't read mapping page %d", ret);
>> > + return -1;
>> > + }
>> > + curr += ret;
>> > + if (curr == len)
>> > + break;
>> > + }
>> > }
>> >
>> > if (opts.auto_dedup) {
>> > --
>> > 1.9.1
>> >
>> _______________________________________________
>> CRIU mailing list
>> CRIU at openvz.org
>> https://lists.openvz.org/mailman/listinfo/criu
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
More information about the CRIU
mailing list