Re: [Qemu-devel] [PATCH 1/2] block: Fix unaligned zero write

2015-03-23 Thread Fam Zheng
On Mon, 03/23 14:14, Stefan Hajnoczi wrote: > On Mon, Mar 23, 2015 at 12:46:09PM +0800, Fam Zheng wrote: > > @@ -3435,6 +3446,10 @@ static int coroutine_fn > > bdrv_co_do_pwritev(BlockDriverState *bs, > > bytes = ROUND_UP(bytes, align); > > } > > > > +if (use_local_qiov) { > >

Re: [Qemu-devel] [PATCH 1/2] block: Fix unaligned zero write

2015-03-23 Thread Stefan Hajnoczi
On Mon, Mar 23, 2015 at 12:46:09PM +0800, Fam Zheng wrote: > @@ -3435,6 +3446,10 @@ static int coroutine_fn > bdrv_co_do_pwritev(BlockDriverState *bs, > bytes = ROUND_UP(bytes, align); > } > > +if (use_local_qiov) { > +/* Local buffer may have non-zero data. */ > +

[Qemu-devel] [PATCH 1/2] block: Fix unaligned zero write

2015-03-22 Thread Fam Zheng
If the zero write is not aligned, bdrv_co_do_pwritev will segfault because of accessing to the NULL qiov passed in by bdrv_co_write_zeroes. Fix this by allocating a local qiov in bdrv_co_do_pwritev if the request is not aligned. (In this case the padding iovs are necessary anyway, so it doesn't hur