1. 27 9月, 2013 1 次提交
    • M
      qcow2: Correct bitmap size in zero expansion · e390cf5a
      Max Reitz 提交于
      Since the expanded_clusters bitmap is addressed using host offsets in
      the underlying image file, the correct size to use for allocating the
      bitmap is not determined by the guest disk image but by the underlying
      host image file.
      
      Furthermore, this size may change during the expansion due to cluster
      allocations on growable image files. In this case, the bitmap needs to
      be resized as well to reflect the growth.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      e390cf5a
  2. 26 9月, 2013 1 次提交
    • M
      qcow2: Assert against currently impossible overflow · c01dbccb
      Max Reitz 提交于
      If qcow2_alloc_cluster_link_l2 is called with a QCowL2Meta describing a
      request crossing L2 boundaries, a buffer overflow will occur. This is
      impossible right now since such requests are never generated (every
      request is shortened to L2 boundaries before) and probably also
      completely unintended (considering the name "QCowL2Meta"), however, it
      is still worth an assertion.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c01dbccb
  3. 12 9月, 2013 2 次提交
  4. 30 8月, 2013 2 次提交
  5. 24 6月, 2013 2 次提交
  6. 14 5月, 2013 1 次提交
    • K
      qcow2: Catch some L1 table index overflows · 2cf7cfa1
      Kevin Wolf 提交于
      This catches the situation that is described in the bug report at
      https://bugs.launchpad.net/qemu/+bug/865518 and goes like this:
      
          $ qemu-img create -f qcow2 huge.qcow2 $((1024*1024))T
          Formatting 'huge.qcow2', fmt=qcow2 size=1152921504606846976 encryption=off cluster_size=65536 lazy_refcounts=off
          $ qemu-io /tmp/huge.qcow2 -c "write $((1024*1024*1024*1024*1024*1024 - 1024)) 512"
          Segmentation fault
      
      With this patch applied the segfault will be avoided, however the case
      will still fail, though gracefully:
      
          $ qemu-img create -f qcow2 /tmp/huge.qcow2 $((1024*1024))T
          Formatting 'huge.qcow2', fmt=qcow2 size=1152921504606846976 encryption=off cluster_size=65536 lazy_refcounts=off
          qemu-img: The image size is too large for file format 'qcow2'
      
      Note that even long before these overflow checks kick in, you get
      insanely high memory usage (up to INT_MAX * sizeof(uint64_t) = 16 GB for
      the L1 table), so with somewhat smaller image sizes you'll probably see
      qemu aborting for a failed g_malloc().
      
      If you need huge image sizes, you should increase the cluster size to
      the maximum of 2 MB in order to get higher limits.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
      2cf7cfa1
  7. 28 3月, 2013 18 次提交
  8. 15 3月, 2013 2 次提交
  9. 19 12月, 2012 1 次提交
  10. 13 12月, 2012 6 次提交
  11. 07 8月, 2012 1 次提交
    • S
      qcow2: implement lazy refcounts · bfe8043e
      Stefan Hajnoczi 提交于
      Lazy refcounts is a performance optimization for qcow2 that postpones
      refcount metadata updates and instead marks the image dirty.  In the
      case of crash or power failure the image will be left in a dirty state
      and repaired next time it is opened.
      
      Reducing metadata I/O is important for cache=writethrough and
      cache=directsync because these modes guarantee that data is on disk
      after each write (hence we cannot take advantage of caching updates in
      RAM).  Refcount metadata is not needed for guest->file block address
      translation and therefore does not need to be on-disk at the time of
      write completion - this is the motivation behind the lazy refcount
      optimization.
      
      The lazy refcount optimization must be enabled at image creation time:
      
        qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=on a.qcow2 10G
        qemu-system-x86_64 -drive if=virtio,file=a.qcow2,cache=writethrough
      
      Update qemu-iotests 031 and 036 since the extension header size changes
      when we add feature bit table entries.
      Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      bfe8043e
  12. 15 6月, 2012 3 次提交