* [Qemu-devel] [PULL 0/1] Block job patches @ 2015-10-01 19:05 Jeff Cody 2015-10-01 19:05 ` [Qemu-devel] [PULL 1/1] block: mirror - fix full sync mode when target does not support zero init Jeff Cody 2015-10-02 10:47 ` [Qemu-devel] [PULL 0/1] Block job patches Peter Maydell 0 siblings, 2 replies; 3+ messages in thread From: Jeff Cody @ 2015-10-01 19:05 UTC (permalink / raw) To: qemu-block; +Cc: peter.maydell, jcody, qemu-devel The following changes since commit fa500928ad9da6dd570918e3dfca13c029af07a8: Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150930' into staging (2015-10-01 10:49:38 +0100) are available in the git repository at: git@github.com:codyprime/qemu-kvm-jtc.git tags/block-pull-request for you to fetch changes up to 5279efebcf8f8fbf2ed2feed63cdb9d375c7cd07: block: mirror - fix full sync mode when target does not support zero init (2015-10-01 15:02:21 -0400) ---------------------------------------------------------------- Block job patches ---------------------------------------------------------------- Jeff Cody (1): block: mirror - fix full sync mode when target does not support zero init block/mirror.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 1.9.3 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PULL 1/1] block: mirror - fix full sync mode when target does not support zero init 2015-10-01 19:05 [Qemu-devel] [PULL 0/1] Block job patches Jeff Cody @ 2015-10-01 19:05 ` Jeff Cody 2015-10-02 10:47 ` [Qemu-devel] [PULL 0/1] Block job patches Peter Maydell 1 sibling, 0 replies; 3+ messages in thread From: Jeff Cody @ 2015-10-01 19:05 UTC (permalink / raw) To: qemu-block; +Cc: peter.maydell, jcody, qemu-devel During mirror, if the target device does not support zero init, a mirror may result in a corrupted image for sync="full" mode. This is due to how the initial dirty bitmap is set up prior to copying data - we did not mark sectors as dirty that are unallocated. This means those unallocated sectors are skipped over on the target, and for a device without zero init, invalid data may reside in those holes. If both of the following conditions are true, then we will explicitly mark all sectors as dirty: 1.) sync = "full" 2.) bdrv_has_zero_init(target) == false If the target does support zero init, but a target image is passed in with data already present (i.e. an "existing" image), it is assumed the data present in the existing image is valid data for those sectors. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 91ed4bc5bda7e2b09eb508b07c83f4071fe0b3c9.1443705220.git.jcody@redhat.com Signed-off-by: Jeff Cody <jcody@redhat.com> --- block/mirror.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/mirror.c b/block/mirror.c index a258926..87928ab 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -455,6 +455,8 @@ static void coroutine_fn mirror_run(void *opaque) if (!s->is_none_mode) { /* First part, loop on the sectors and initialize the dirty bitmap. */ BlockDriverState *base = s->base; + bool mark_all_dirty = s->base == NULL && !bdrv_has_zero_init(s->target); + for (sector_num = 0; sector_num < end; ) { /* Just to make sure we are not exceeding int limit. */ int nb_sectors = MIN(INT_MAX >> BDRV_SECTOR_BITS, @@ -477,7 +479,7 @@ static void coroutine_fn mirror_run(void *opaque) } assert(n > 0); - if (ret == 1) { + if (ret == 1 || mark_all_dirty) { bdrv_set_dirty_bitmap(s->dirty_bitmap, sector_num, n); } sector_num += n; -- 1.9.3 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PULL 0/1] Block job patches 2015-10-01 19:05 [Qemu-devel] [PULL 0/1] Block job patches Jeff Cody 2015-10-01 19:05 ` [Qemu-devel] [PULL 1/1] block: mirror - fix full sync mode when target does not support zero init Jeff Cody @ 2015-10-02 10:47 ` Peter Maydell 1 sibling, 0 replies; 3+ messages in thread From: Peter Maydell @ 2015-10-02 10:47 UTC (permalink / raw) To: Jeff Cody; +Cc: QEMU Developers, Qemu-block On 1 October 2015 at 20:05, Jeff Cody <jcody@redhat.com> wrote: > The following changes since commit fa500928ad9da6dd570918e3dfca13c029af07a8: > > Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20150930' into staging (2015-10-01 10:49:38 +0100) > > are available in the git repository at: > > > git@github.com:codyprime/qemu-kvm-jtc.git tags/block-pull-request > > for you to fetch changes up to 5279efebcf8f8fbf2ed2feed63cdb9d375c7cd07: > > block: mirror - fix full sync mode when target does not support zero init (2015-10-01 15:02:21 -0400) > > ---------------------------------------------------------------- > Block job patches > ---------------------------------------------------------------- > > Jeff Cody (1): > block: mirror - fix full sync mode when target does not support zero > init > > block/mirror.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > Applied, thanks. -- PMM ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-02 10:47 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-10-01 19:05 [Qemu-devel] [PULL 0/1] Block job patches Jeff Cody 2015-10-01 19:05 ` [Qemu-devel] [PULL 1/1] block: mirror - fix full sync mode when target does not support zero init Jeff Cody 2015-10-02 10:47 ` [Qemu-devel] [PULL 0/1] Block job patches Peter Maydell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).