qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v7 11/19] block: vhdx write support


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v7 11/19] block: vhdx write support
Date: Fri, 18 Oct 2013 14:12:08 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Oct 11, 2013 at 02:17:31PM -0400, Jeff Cody wrote:
> +            case PAYLOAD_BLOCK_FULLY_PRESENT:
> +                /* if the file offset address is in the header zone,
> +                 * there is a problem */
> +                if (sinfo.file_offset < (1024 * 1024)) {

When a block is allocated we update s->bat[] and changed the file size.
This should be undone so that in-memory and on-disk metadata doesn't get
out of sync.

> +                    ret = -EFAULT;
> +                    goto exit;
> +                }
> +
> +                if (!use_zero_buffers) {
> +                    qemu_iovec_concat(&hd_qiov, qiov,  bytes_done,
> +                                      sinfo.bytes_avail);
> +                }
> +                /* block exists, so we can just overwrite it */
> +                qemu_co_mutex_unlock(&s->lock);
> +                ret = bdrv_co_writev(bs->file,
> +                                    sinfo.file_offset >> BDRV_SECTOR_BITS,
> +                                    sectors_to_write, &hd_qiov);
> +                qemu_co_mutex_lock(&s->lock);
> +                if (ret < 0) {
> +                    goto exit;

Same comment about in-memory and on-disk metadata getting out of sync in
the error case.

> +exit:
> +    qemu_vfree(iov1.iov_base);
> +    qemu_vfree(iov2.iov_base);
> +    qemu_co_mutex_unlock(&s->lock);
> +    return ret;

Missing qemu_iovec_destroy(&hd_qiov).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]