Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Kevin Wolf
Am 30.09.2015 um 18:06 hat Paolo Bonzini geschrieben: > > > On 30/09/2015 18:02, Jeff Cody wrote: > > As a general rule for blockjobs, I disagree. > > > > Right away, there is a key difference: we don't know that the image is > > (or should be) empty. > > Not necessarily empty. sync='top' && m

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Paolo Bonzini
On 30/09/2015 16:43, Jeff Cody wrote: > One issue is that QEMU will do mode!='existing' && sync!='full' for > drivers that do not support backing files (raw host devices, for > instance). Yup, this can be used to get a mirror of future operations (the idea was to support things such as antivirus

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Paolo Bonzini
On 30/09/2015 18:02, Jeff Cody wrote: > As a general rule for blockjobs, I disagree. > > Right away, there is a key difference: we don't know that the image is > (or should be) empty. Not necessarily empty. sync='top' && mode='existing' && !target->backing_file, for example, makes sense if the

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Jeff Cody
On Tue, Sep 29, 2015 at 12:52:33PM +0200, Paolo Bonzini wrote: > > > On 29/09/2015 11:35, Kevin Wolf wrote: > > The caller could be copying the backing file in the background and it > > may not yet be finished. > > Yes, and this is permitted (the destination file of mirroring is opened > with BD

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Jeff Cody
On Wed, Sep 30, 2015 at 05:26:28PM +0200, Kevin Wolf wrote: > Am 30.09.2015 um 16:43 hat Jeff Cody geschrieben: > > On Tue, Sep 29, 2015 at 12:52:33PM +0200, Paolo Bonzini wrote: > > > > > > > > > On 29/09/2015 11:35, Kevin Wolf wrote: > > > > The caller could be copying the backing file in the b

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-10-01 Thread Kevin Wolf
Am 30.09.2015 um 16:43 hat Jeff Cody geschrieben: > On Tue, Sep 29, 2015 at 12:52:33PM +0200, Paolo Bonzini wrote: > > > > > > On 29/09/2015 11:35, Kevin Wolf wrote: > > > The caller could be copying the backing file in the background and it > > > may not yet be finished. > > > > Yes, and this i

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-30 Thread Paolo Bonzini
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 29/09/2015 10:39, Kevin Wolf wrote: > bdrv_has_zero_init() takes care of that, in theory. The "problem" > here is that the target is opened with BDRV_O_NO_BACKING, so the > block layer doesn't consider this an image with a backing file. I think

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-29 Thread Paolo Bonzini
On 29/09/2015 11:35, Kevin Wolf wrote: > The caller could be copying the backing file in the background and it > may not yet be finished. Yes, and this is permitted (the destination file of mirroring is opened with BDRV_O_NO_BACKING). Some more assumptions arise when block-job-complete is invok

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-29 Thread Kevin Wolf
Am 29.09.2015 um 10:42 hat Paolo Bonzini geschrieben: > > > On 29/09/2015 10:10, Kevin Wolf wrote: > >> When mode == 'existing' for a shallow mirror (sync != 'full'), > >> that is the caller stating that the guest-visible contents of the > >> destination match the guest-visible contents of the ba

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-29 Thread Paolo Bonzini
On 29/09/2015 10:10, Kevin Wolf wrote: >> When mode == 'existing' for a shallow mirror (sync != 'full'), >> that is the caller stating that the guest-visible contents of the >> destination match the guest-visible contents of the backing >> image. The only sectors to be copied are those that diff

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-29 Thread Kevin Wolf
Am 28.09.2015 um 23:57 hat Jeff Cody geschrieben: > On Sep 28, 2015 5:31 PM, "Kevin Wolf" wrote: > > > > (Responding from mobile phone again) > > > Am 28.09.2015 um 05:29 hat Jeff Cody geschrieben: > > > During mirror, if the target device does not have support zero > > > initialization, a mirro

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-29 Thread Kevin Wolf
Am 28.09.2015 um 22:31 hat Eric Blake geschrieben: > On 09/28/2015 08:13 AM, Paolo Bonzini wrote: > > > > > > On 28/09/2015 05:29, Jeff Cody wrote: > >> This only occurs under two conditions: > >> > >> 1. 'mode' != "existing" > >> 2. bdrv_has_zero_init(target) == NULL > >> > > > > I'm no

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Eric Blake
On 09/28/2015 03:32 PM, Jeff Cody wrote: > I guess that makes sense. What about the case when the target is a raw > device without zero init? There is no backing file... Of course, perhaps > in the raw case the user should be using sync==full anyways. > >> >> 2) even with mode == "existing" yo

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Jeff Cody
On Sep 28, 2015 5:34 PM, "Kevin Wolf" wrote: > > Am 28.09.2015 um 05:29 hat Jeff Cody geschrieben: > > During mirror, if the target device does not have support zero > > initialization, a mirror may result in a corrupt image. > > > > For instance, on mirror to a host device with format = raw, what

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Jeff Cody
On Sep 28, 2015 5:31 PM, "Kevin Wolf" wrote: > (Responding from mobile phone again) > Am 28.09.2015 um 05:29 hat Jeff Cody geschrieben: > > During mirror, if the target device does not have support zero > > initialization, a mirror may result in a corrupt image. > > I think you want to check thi

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Eric Blake
On 09/28/2015 08:13 AM, Paolo Bonzini wrote: > > > On 28/09/2015 05:29, Jeff Cody wrote: >> This only occurs under two conditions: >> >> 1. 'mode' != "existing" >> 2. bdrv_has_zero_init(target) == NULL >> > > I'm not sure if mode != "existing" actually matters. I think what > actually m

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Jeff Cody
On Sep 28, 2015 4:12 PM, "Paolo Bonzini" wrote: > > Replying from mobile; please excuse any formatting issues. > > On 28/09/2015 05:29, Jeff Cody wrote: > > This only occurs under two conditions: > > > > 1. 'mode' != "existing" > > 2. bdrv_has_zero_init(target) == NULL > > > > I'm not su

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Kevin Wolf
Am 28.09.2015 um 05:29 hat Jeff Cody geschrieben: > During mirror, if the target device does not have support zero > initialization, a mirror may result in a corrupt image. I think you want to check this sentence. ("During mirror [...], a mirror may result [...]") > For instance, on mirror to a h

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Kevin Wolf
Am 28.09.2015 um 05:29 hat Jeff Cody geschrieben: > During mirror, if the target device does not have support zero > initialization, a mirror may result in a corrupt image. > > For instance, on mirror to a host device with format = raw, whatever > random data is on the target device will still be

Re: [Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-28 Thread Paolo Bonzini
On 28/09/2015 05:29, Jeff Cody wrote: > This only occurs under two conditions: > > 1. 'mode' != "existing" > 2. bdrv_has_zero_init(target) == NULL > I'm not sure if mode != "existing" actually matters. I think what actually matters is sync == "full". The reasons are: 1) with sync !=

[Qemu-devel] [PATCH 3/3] block: mirror - zero unallocated target sectors when zero init not present

2015-09-27 Thread Jeff Cody
During mirror, if the target device does not have support zero initialization, a mirror may result in a corrupt image. For instance, on mirror to a host device with format = raw, whatever random data is on the target device will still be there for unallocated sectors. This is because during the m