Blame 0161-sheepdog-fix-savevm-and-loadvm.patch

5544c1
From f065553b45322bb0ba14a4c9d1fb65554ae3e325 Mon Sep 17 00:00:00 2001
5544c1
From: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
5544c1
Date: Thu, 30 Aug 2012 03:39:45 +0900
5544c1
Subject: [PATCH] sheepdog: fix savevm and loadvm
5544c1
5544c1
This patch sets data to be sent to Sheepdog correctly and fixes savevm
5544c1
and loadvm operations on a Sheepdog image.
5544c1
5544c1
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
5544c1
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5544c1
(cherry picked from commit 1f7a48de4467f31afc51169122453318efdb0f33)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 block/sheepdog.c | 3 ++-
5544c1
 1 file changed, 2 insertions(+), 1 deletion(-)
5544c1
5544c1
diff --git a/block/sheepdog.c b/block/sheepdog.c
5544c1
index df4f441..e0753ee 100644
5544c1
--- a/block/sheepdog.c
5544c1
+++ b/block/sheepdog.c
5544c1
@@ -1986,7 +1986,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,
5544c1
         vdi_index = pos / SD_DATA_OBJ_SIZE;
5544c1
         offset = pos % SD_DATA_OBJ_SIZE;
5544c1
 
5544c1
-        data_len = MIN(remaining, SD_DATA_OBJ_SIZE);
5544c1
+        data_len = MIN(remaining, SD_DATA_OBJ_SIZE - offset);
5544c1
 
5544c1
         vmstate_oid = vid_to_vmstate_oid(s->inode.vdi_id, vdi_index);
5544c1
 
5544c1
@@ -2007,6 +2007,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,
5544c1
         }
5544c1
 
5544c1
         pos += data_len;
5544c1
+        data += data_len;
5544c1
         remaining -= data_len;
5544c1
     }
5544c1
     ret = size;
5544c1
-- 
5544c1
1.7.12.1
5544c1