qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 0/1] qemu: fix the bug reported by qemu-iotests case 055
@ 2016-12-16  5:20 QingFeng Hao
  2016-12-16  5:20 ` [Qemu-devel] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba QingFeng Hao
  0 siblings, 1 reply; 7+ messages in thread
From: QingFeng Hao @ 2016-12-16  5:20 UTC (permalink / raw)
  To: qemu-devel, qemu-block
  Cc: borntraeger, cornelia.huck, liujbjl, kwolf, famz, QingFeng Hao,
	qemu-stable

Hi all,
v3 doesn't have code change but got the reviewed-by from Fam Zheng(thanks
to Fam).
v2 includes changes due to review comments by Kevin Wolf(thanks to Kevin).

v3:
* Got reviewed-by from Fam Zheng.
* Based on master's commit:
  6a928d25b6: Update version for v2.8.0-rc4 release

v2:
* Add endian conversion for lba field in vmdk_write_extent.
* Based on master's commit:
  00227fefd205: Update version for v2.8.0-rc1 release

v1:
* Add patch to fix the bug reported by qemu-iotests case 055.
  Jing Liu and I found the cause was in vmdk and the fix is in the
  followed patch.
  Based on master's commit:
  00227fefd205: Update version for v2.8.0-rc1 release

  Upstream master's qemu-iotests case 055 reports the following error:
  +qemu-img: Error while reading offset 0 of tests/qemu-iotests/scratch/blockdev-target.img: Invalid argument
  +qemu-img: Error while reading offset 0 of tests/qemu-iotests/scratch/blockdev-target.img: Invalid argument
  +qemu-img: Error while reading offset 0 of tests/qemu-iotests/scratch/blockdev-target.img: Invalid argument
  +qemu-img: Error while reading offset 0 of tests/qemu-iotests/scratch/blockdev-target.img: Invalid argument 

Thanks!
QingFeng Hao

Cc: qemu-stable@nongnu.org

QingFeng Hao (1):
  block/vmdk: Fix the endian problem of buf_len and lba

 block/vmdk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.8.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2016-12-16  5:20 [Qemu-devel] [PATCH v3 0/1] qemu: fix the bug reported by qemu-iotests case 055 QingFeng Hao
@ 2016-12-16  5:20 ` QingFeng Hao
  2017-01-16  2:38   ` liujing
  2017-01-25 16:25   ` [Qemu-devel] [Qemu-block] " Max Reitz
  0 siblings, 2 replies; 7+ messages in thread
From: QingFeng Hao @ 2016-12-16  5:20 UTC (permalink / raw)
  To: qemu-devel, qemu-block
  Cc: borntraeger, cornelia.huck, liujbjl, kwolf, famz, QingFeng Hao,
	qemu-stable

The problem was triggered by qemu-iotests case 055. It failed when it
was comparing the compressed vmdk image with original test.img.

The cause is that buf_len in vmdk_write_extent wasn't converted to
little-endian before it was stored to disk. But later vmdk_read_extent
read it and converted it from little-endian to cpu endian.
If the cpu is big-endian like s390, the problem will happen and
the data length read by vmdk_read_extent will become invalid!
The fix is to add the conversion in vmdk_write_extent, meanwhile,
repair the endianness problem of lba field which shall also be converted
to little-endian before storing to disk.

Cc: qemu-stable@nongnu.org
Signed-off-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
---
 block/vmdk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/vmdk.c b/block/vmdk.c
index a11c27a..26e5f95 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1354,8 +1354,8 @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset,
             goto out;
         }
 
-        data->lba = offset >> BDRV_SECTOR_BITS;
-        data->size = buf_len;
+        data->lba = cpu_to_le64(offset >> BDRV_SECTOR_BITS);
+        data->size = cpu_to_le32(buf_len);
 
         n_bytes = buf_len + sizeof(VmdkGrainMarker);
         iov = (struct iovec) {
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2016-12-16  5:20 ` [Qemu-devel] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba QingFeng Hao
@ 2017-01-16  2:38   ` liujing
  2017-01-16  5:26     ` Fam Zheng
  2017-01-25 16:25   ` [Qemu-devel] [Qemu-block] " Max Reitz
  1 sibling, 1 reply; 7+ messages in thread
From: liujing @ 2017-01-16  2:38 UTC (permalink / raw)
  To: qemu-devel, qemu-block, borntraeger, cornelia.huck
  Cc: QingFeng Hao, kwolf, famz, qemu-stable

Dears,

We would like to know if this patch will be pulled

into upstream or what else we need to do for it?

Because for upstream, the qemu-iotests case 055 still failed.

Thanks.

Jing


On 12/16/2016 01:20 PM, QingFeng Hao wrote:
> The problem was triggered by qemu-iotests case 055. It failed when it
> was comparing the compressed vmdk image with original test.img.
>
> The cause is that buf_len in vmdk_write_extent wasn't converted to
> little-endian before it was stored to disk. But later vmdk_read_extent
> read it and converted it from little-endian to cpu endian.
> If the cpu is big-endian like s390, the problem will happen and
> the data length read by vmdk_read_extent will become invalid!
> The fix is to add the conversion in vmdk_write_extent, meanwhile,
> repair the endianness problem of lba field which shall also be converted
> to little-endian before storing to disk.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
> Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> Reviewed-by: Fam Zheng <famz@redhat.com>
> ---
>   block/vmdk.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/block/vmdk.c b/block/vmdk.c
> index a11c27a..26e5f95 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -1354,8 +1354,8 @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset,
>               goto out;
>           }
>
> -        data->lba = offset >> BDRV_SECTOR_BITS;
> -        data->size = buf_len;
> +        data->lba = cpu_to_le64(offset >> BDRV_SECTOR_BITS);
> +        data->size = cpu_to_le32(buf_len);
>
>           n_bytes = buf_len + sizeof(VmdkGrainMarker);
>           iov = (struct iovec) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2017-01-16  2:38   ` liujing
@ 2017-01-16  5:26     ` Fam Zheng
  2017-01-23 10:51       ` Fam Zheng
  0 siblings, 1 reply; 7+ messages in thread
From: Fam Zheng @ 2017-01-16  5:26 UTC (permalink / raw)
  To: liujing, kwolf
  Cc: qemu-devel, qemu-block, borntraeger,
	cornelia.huck@de.ibm.com QingFeng Hao, qemu-stable

On Mon, 01/16 10:38, liujing wrote:
> Dears,
> 
> We would like to know if this patch will be pulled
> 
> into upstream or what else we need to do for it?
> 
> Because for upstream, the qemu-iotests case 055 still failed.

Kevin, would you like to take this or should I do it?

Fam

> 
> Thanks.
> 
> Jing
> 
> 
> On 12/16/2016 01:20 PM, QingFeng Hao wrote:
> > The problem was triggered by qemu-iotests case 055. It failed when it
> > was comparing the compressed vmdk image with original test.img.
> > 
> > The cause is that buf_len in vmdk_write_extent wasn't converted to
> > little-endian before it was stored to disk. But later vmdk_read_extent
> > read it and converted it from little-endian to cpu endian.
> > If the cpu is big-endian like s390, the problem will happen and
> > the data length read by vmdk_read_extent will become invalid!
> > The fix is to add the conversion in vmdk_write_extent, meanwhile,
> > repair the endianness problem of lba field which shall also be converted
> > to little-endian before storing to disk.
> > 
> > Cc: qemu-stable@nongnu.org
> > Signed-off-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
> > Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > Reviewed-by: Fam Zheng <famz@redhat.com>
> > ---
> >   block/vmdk.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/block/vmdk.c b/block/vmdk.c
> > index a11c27a..26e5f95 100644
> > --- a/block/vmdk.c
> > +++ b/block/vmdk.c
> > @@ -1354,8 +1354,8 @@ static int vmdk_write_extent(VmdkExtent *extent, int64_t cluster_offset,
> >               goto out;
> >           }
> > 
> > -        data->lba = offset >> BDRV_SECTOR_BITS;
> > -        data->size = buf_len;
> > +        data->lba = cpu_to_le64(offset >> BDRV_SECTOR_BITS);
> > +        data->size = cpu_to_le32(buf_len);
> > 
> >           n_bytes = buf_len + sizeof(VmdkGrainMarker);
> >           iov = (struct iovec) {
> 
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2017-01-16  5:26     ` Fam Zheng
@ 2017-01-23 10:51       ` Fam Zheng
  0 siblings, 0 replies; 7+ messages in thread
From: Fam Zheng @ 2017-01-23 10:51 UTC (permalink / raw)
  To: liujing, kwolf, mreitz
  Cc: borntraeger, qemu-stable, qemu-devel, qemu-block,
	cornelia.huck@de.ibm.com QingFeng Hao

On Mon, 01/16 13:26, Fam Zheng wrote:
> On Mon, 01/16 10:38, liujing wrote:
> > Dears,
> > 
> > We would like to know if this patch will be pulled
> > 
> > into upstream or what else we need to do for it?
> > 
> > Because for upstream, the qemu-iotests case 055 still failed.
> 
> Kevin, would you like to take this or should I do it?

Adding Max since he's taking care of the other VMDK fix I posted.

Fam

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2016-12-16  5:20 ` [Qemu-devel] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba QingFeng Hao
  2017-01-16  2:38   ` liujing
@ 2017-01-25 16:25   ` Max Reitz
  2017-02-13  9:17     ` Hao QingFeng
  1 sibling, 1 reply; 7+ messages in thread
From: Max Reitz @ 2017-01-25 16:25 UTC (permalink / raw)
  To: QingFeng Hao, qemu-devel, qemu-block
  Cc: kwolf, famz, qemu-stable, borntraeger, cornelia.huck

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]

On 16.12.2016 06:20, QingFeng Hao wrote:
> The problem was triggered by qemu-iotests case 055. It failed when it
> was comparing the compressed vmdk image with original test.img.
>
> The cause is that buf_len in vmdk_write_extent wasn't converted to
> little-endian before it was stored to disk. But later vmdk_read_extent
> read it and converted it from little-endian to cpu endian.
> If the cpu is big-endian like s390, the problem will happen and
> the data length read by vmdk_read_extent will become invalid!
> The fix is to add the conversion in vmdk_write_extent, meanwhile,
> repair the endianness problem of lba field which shall also be converted
> to little-endian before storing to disk.
>
> Cc: qemu-stable@nongnu.org
> Signed-off-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
> Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> Reviewed-by: Fam Zheng <famz@redhat.com>
> ---
>  block/vmdk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Thanks, I've applied the patch to my block tree:

https://github.com/XanClic/qemu/commits/block

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 512 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [Qemu-block] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2017-01-25 16:25   ` [Qemu-devel] [Qemu-block] " Max Reitz
@ 2017-02-13  9:17     ` Hao QingFeng
  0 siblings, 0 replies; 7+ messages in thread
From: Hao QingFeng @ 2017-02-13  9:17 UTC (permalink / raw)
  To: Max Reitz, qemu-devel, qemu-block
  Cc: kwolf, famz, qemu-stable, borntraeger, cornelia.huck



在 2017-01-26 0:25, Max Reitz 写道:
> On 16.12.2016 06:20, QingFeng Hao wrote:
>> The problem was triggered by qemu-iotests case 055. It failed when it
>> was comparing the compressed vmdk image with original test.img.
>>
>> The cause is that buf_len in vmdk_write_extent wasn't converted to
>> little-endian before it was stored to disk. But later vmdk_read_extent
>> read it and converted it from little-endian to cpu endian.
>> If the cpu is big-endian like s390, the problem will happen and
>> the data length read by vmdk_read_extent will become invalid!
>> The fix is to add the conversion in vmdk_write_extent, meanwhile,
>> repair the endianness problem of lba field which shall also be converted
>> to little-endian before storing to disk.
>>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: QingFeng Hao <haoqf@linux.vnet.ibm.com>
>> Signed-off-by: Jing Liu <liujbjl@linux.vnet.ibm.com>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> Reviewed-by: Fam Zheng <famz@redhat.com>
>> ---
>>   block/vmdk.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
> Thanks, I've applied the patch to my block tree:
>
> https://github.com/XanClic/qemu/commits/block
Thanks Max!
>
> Max
>

-- 
QingFeng Hao(Robin)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-02-13  9:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-16  5:20 [Qemu-devel] [PATCH v3 0/1] qemu: fix the bug reported by qemu-iotests case 055 QingFeng Hao
2016-12-16  5:20 ` [Qemu-devel] [PATCH v3 1/1] block/vmdk: Fix the endian problem of buf_len and lba QingFeng Hao
2017-01-16  2:38   ` liujing
2017-01-16  5:26     ` Fam Zheng
2017-01-23 10:51       ` Fam Zheng
2017-01-25 16:25   ` [Qemu-devel] [Qemu-block] " Max Reitz
2017-02-13  9:17     ` Hao QingFeng

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).