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) {
> >
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. */
> +
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