[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/2] block: fix write with zero flag set and
From: |
Alberto Garcia |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/2] block: fix write with zero flag set and iovector provided |
Date: |
Mon, 12 Feb 2018 16:03:49 +0100 |
User-agent: |
Notmuch/0.18.2 (http://notmuchmail.org) Emacs/24.4.1 (i586-pc-linux-gnu) |
On Mon 12 Feb 2018 02:14:01 PM CET, Anton Nefedov wrote:
> The normal bdrv_co_pwritev() use is either
> - BDRV_REQ_ZERO_WRITE clear and iovector provided
> - BDRV_REQ_ZERO_WRITE set and iovector == NULL
>
> while
> - the flag clear and iovector == NULL is an assertion failure
> in bdrv_co_do_zero_pwritev()
> - the flag set and iovector provided is in fact allowed
> (the flag prevails and zeroes are written)
>
> However the alignment logic does not support the latter case so the
> padding areas get overwritten with zeroes.
Oh, so this doesn't simply write zeroes in [offset, offset+bytes), but
also in the head and tail areas, instead of keeping the previous
contents.
This is a pretty serious bug, but I assume it can't be triggered
(bdrv_pwrite_zeroes() is used in complete clusters). Did you check if
there was any other scenario where this could happen?
> Signed-off-by: Anton Nefedov <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
Berto