[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [TAPDISK] Fix qcow initialization bug.



# HG changeset patch
# User Jake Wires <jwires@xxxxxxxxxxxxx>
# Date 1176230443 25200
# Node ID 380db34694d7ceb80a4e8f21211c2e10047d92e5
# Parent  4dc14c591e6cf5177974f244db9ae4f609521417
[TAPDISK] Fix qcow initialization bug.

fd_end was being incorrectly initialized upon open, leading to data corruption.

Signed-off-by: Jake Wires <jwires@xxxxxxxxxxxxx>
---
 tools/blktap/drivers/block-qcow.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff -r 4dc14c591e6c -r 380db34694d7 tools/blktap/drivers/block-qcow.c
--- a/tools/blktap/drivers/block-qcow.c Tue Apr 10 18:49:20 2007 +0100
+++ b/tools/blktap/drivers/block-qcow.c Tue Apr 10 11:40:43 2007 -0700
@@ -949,8 +949,14 @@ int tdqcow_open (struct disk_driver *dd,
                goto fail;
        }
        init_fds(dd);
-       s->fd_end = (final_cluster == 0 ? (s->l1_table_offset + l1_table_size) 
: 
-                               (final_cluster + s->cluster_size));
+
+       if (!final_cluster)
+               s->fd_end = s->l1_table_offset + l1_table_size;
+       else {
+               s->fd_end = lseek64(fd, 0, SEEK_END);
+               if (s->fd_end == (off64_t)-1)
+                       goto fail;
+       }
 
        return 0;
        

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.