On Sat, May 14, 2016 at 03:45:52PM +0300, Denis V. Lunev wrote:
> + qemu_co_mutex_lock(&s->lock);
> + cluster_offset = get_cluster_offset(bs, sector_num << 9, 2, out_len, 0,
> 0);
> + qemu_co_mutex_unlock(&s->lock);
> + if (cluster_offset == 0) {
> + ret = -EIO;
> + goto fail;
> + }
> + cluster_offset &= s->cluster_offset_mask;
> +
> + iov = (struct iovec) {
> + .iov_base = out_buf,
> + .iov_len = out_len,
> + };
> + qemu_iovec_init_external(&hd_qiov, &iov, 1);
> + ret = bdrv_co_pwritev(bs->file->bs, cluster_offset, out_len, &hd_qiov,
> 0);Not sure if this has the same race condition as the qcow2 patch. It seems that bdrv_getlength() is used to extend the file on a per-sector basis. That would mean compressed data is not packed inside sectors and no read-write-modify race condition exists, but I haven't fully audited get_cluster_offset(). Stefan
signature.asc
Description: PGP signature
