WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] remus: unbreak after 21488:dd6bbdc42033

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] remus: unbreak after 21488:dd6bbdc42033
From: Brendan Cully <brendan@xxxxxxxxx>
Date: Wed, 18 Aug 2010 13:07:03 -0700
Delivery-date: Wed, 18 Aug 2010 13:07:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.5.2+5-0c8646292ca4
# HG changeset patch
# User Brendan Cully <brendan@xxxxxxxxx>
# Date 1282162001 25200
# Node ID f266eb91ae67e6233a3e163918b4c05df4ec0031
# Parent  74b9fe513d8591ca14233590062079b042abb68d
remus: unbreak after 21488:dd6bbdc42033

The aforementioned patch missed several calls to read_exact, causing spurious
timeouts under Remus.

Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>

diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -77,10 +77,14 @@
         len = read(fd, buf + offset, size - offset);
         if ( (len == -1) && ((errno == EINTR) || (errno == EAGAIN)) )
             continue;
-        if ( len == 0 )
+        if ( len == 0 ) {
+            ERROR("0-length read");
             errno = 0;
-        if ( len <= 0 )
+        }
+        if ( len <= 0 ) {
+            ERROR("read_exact_timed failed (read rc: %d, errno: %d)", len, 
errno);
             return -1;
+        }
         offset += len;
     }
 
@@ -694,8 +698,8 @@
         return pagebuf_get_one(xch, ctx, buf, fd, dom);
     } else if (count == -3) {
         /* Skip padding 4 bytes then read the EPT identity PT location. */
-        if ( read_exact(fd, &buf->identpt, sizeof(uint32_t)) ||
-             read_exact(fd, &buf->identpt, sizeof(uint64_t)) )
+        if ( RDEXACT(fd, &buf->identpt, sizeof(uint32_t)) ||
+             RDEXACT(fd, &buf->identpt, sizeof(uint64_t)) )
         {
             PERROR("error read the address of the EPT identity map");
             return -1;
@@ -704,8 +708,8 @@
         return pagebuf_get_one(xch, ctx, buf, fd, dom);
     } else if ( count == -4 )  {
         /* Skip padding 4 bytes then read the vm86 TSS location. */
-        if ( read_exact(fd, &buf->vm86_tss, sizeof(uint32_t)) ||
-             read_exact(fd, &buf->vm86_tss, sizeof(uint64_t)) )
+        if ( RDEXACT(fd, &buf->vm86_tss, sizeof(uint32_t)) ||
+             RDEXACT(fd, &buf->vm86_tss, sizeof(uint64_t)) )
         {
             PERROR("error read the address of the vm86 TSS");
             return -1;
@@ -729,10 +733,10 @@
     } else if ( count == -7 ) {
         uint32_t tsc_mode, khz, incarn;
         uint64_t nsec;
-        if ( read_exact(fd, &tsc_mode, sizeof(uint32_t)) ||
-             read_exact(fd, &nsec, sizeof(uint64_t)) ||
-             read_exact(fd, &khz, sizeof(uint32_t)) ||
-             read_exact(fd, &incarn, sizeof(uint32_t)) ||
+        if ( RDEXACT(fd, &tsc_mode, sizeof(uint32_t)) ||
+             RDEXACT(fd, &nsec, sizeof(uint64_t)) ||
+             RDEXACT(fd, &khz, sizeof(uint32_t)) ||
+             RDEXACT(fd, &incarn, sizeof(uint32_t)) ||
              xc_domain_set_tsc_info(xch, dom, tsc_mode, nsec, khz, incarn) ) {
             PERROR("error reading/restoring tsc info");
             return -1;
@@ -740,8 +744,8 @@
         return pagebuf_get_one(xch, ctx, buf, fd, dom);
     } else if (count == -8 ) {
         /* Skip padding 4 bytes then read the console pfn location. */
-        if ( read_exact(fd, &buf->console_pfn, sizeof(uint32_t)) ||
-             read_exact(fd, &buf->console_pfn, sizeof(uint64_t)) )
+        if ( RDEXACT(fd, &buf->console_pfn, sizeof(uint32_t)) ||
+             RDEXACT(fd, &buf->console_pfn, sizeof(uint64_t)) )
         {
             PERROR("error read the address of the console pfn");
             return -1;
@@ -768,7 +772,7 @@
         }
         buf->pfn_types = ptmp;
     }
-    if ( read_exact(fd, buf->pfn_types + oldcount, count * 
sizeof(*(buf->pfn_types)))) {
+    if ( RDEXACT(fd, buf->pfn_types + oldcount, count * 
sizeof(*(buf->pfn_types)))) {
         PERROR("Error when reading region pfn types");
         return -1;
     }
@@ -795,7 +799,7 @@
         }
         buf->pages = ptmp;
     }
-    if ( read_exact(fd, buf->pages + oldcount * PAGE_SIZE, countpages * 
PAGE_SIZE) ) {
+    if ( RDEXACT(fd, buf->pages + oldcount * PAGE_SIZE, countpages * 
PAGE_SIZE) ) {
         PERROR("Error when reading pages");
         return -1;
     }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>