Chris Webb wrote:
> Hi. I think I'm seeing some data corruption with block device access from
> qemu. I made a sheepdog backed ext3 filesystem inside a qemu with a live CD,

(snip)

> Perhaps only sparsely written vdis are affected?

Thanks you for the bug report!

As you say, this problem occurs when updating sparse images. 
Can you try the following patch?

=
>From 9d7e817fd7d614446628083b2049a77f65636d0b Mon Sep 17 00:00:00 2001
From: MORITA Kazutaka <[email protected]>
Date: Sun, 15 Nov 2009 21:46:34 +0900
Subject: [PATCH] fix vdi object update

Vdi objects had been corrupted when updating multiple objects
in which unallocated objects were included.
This patch updates vdi objects safely.

Signed-off-by: MORITA Kazutaka <[email protected]>
---
 block/sheepdog.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/block/sheepdog.c b/block/sheepdog.c
index 99b2708..ff19436 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1521,8 +1521,10 @@ static void sd_write_done(struct sd_aiocb *acb)
        }
 
        if (inode_dirty) {
-               for (i = 0; i < nr_chunks(acb); i++)
-                       s->inode.data_oid[idx + i] = acb->oid[i];
+               for (i = 0; i < nr_chunks(acb); i++) {
+                       if (acb->oid[i])
+                               s->inode.data_oid[idx + i] = acb->oid[i];
+               }
 
                ret = add_aio_request(s, acb, s->inode.oid, &s->inode,
                                      sizeof(s->inode),
-- 
1.5.6.5

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to