All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/1] qemu: fix the bug reported by qemu-iotests case 055
@ 2016-11-26  5:46 QingFeng Hao
  2016-11-26  5:46 ` [Qemu-devel] [PATCH v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba QingFeng Hao
  2016-11-26  5:51 ` [Qemu-devel] [PATCH v2 0/1] qemu: fix the bug reported by qemu-iotests case 055 Hao QingFeng
  0 siblings, 2 replies; 7+ messages in thread
From: QingFeng Hao @ 2016-11-26  5:46 UTC (permalink / raw)
  To: qemu-devel, qemu-block
  Cc: borntraeger, cornelia.huck, liujbjl, kwolf, QingFeng Hao

Hi all,
v2 includes changes due to review comments by Kevin Wolf(thanks to Kevin).

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 (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 v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2016-11-26  5:46 [Qemu-devel] [PATCH v2 0/1] qemu: fix the bug reported by qemu-iotests case 055 QingFeng Hao
@ 2016-11-26  5:46 ` QingFeng Hao
  2016-11-26 11:46   ` [Qemu-devel] [Qemu-stable] " Fam Zheng
  2016-11-28  7:56   ` [Qemu-devel] " liujing
  2016-11-26  5:51 ` [Qemu-devel] [PATCH v2 0/1] qemu: fix the bug reported by qemu-iotests case 055 Hao QingFeng
  1 sibling, 2 replies; 7+ messages in thread
From: QingFeng Hao @ 2016-11-26  5:46 UTC (permalink / raw)
  To: qemu-devel, qemu-block
  Cc: borntraeger, cornelia.huck, liujbjl, kwolf, 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>
---
 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 v2 0/1] qemu: fix the bug reported by qemu-iotests case 055
  2016-11-26  5:46 [Qemu-devel] [PATCH v2 0/1] qemu: fix the bug reported by qemu-iotests case 055 QingFeng Hao
  2016-11-26  5:46 ` [Qemu-devel] [PATCH v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba QingFeng Hao
@ 2016-11-26  5:51 ` Hao QingFeng
  1 sibling, 0 replies; 7+ messages in thread
From: Hao QingFeng @ 2016-11-26  5:51 UTC (permalink / raw)
  To: qemu-devel, qemu-block
  Cc: borntraeger, cornelia.huck, liujbjl, kwolf, qemu-stable

Sorry, missed Cc qemu-stable in this patch.


在 2016-11-26 13:46, QingFeng Hao 写道:
> Hi all,
> v2 includes changes due to review comments by Kevin Wolf(thanks to Kevin).
>
> 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 (1):
>    block/vmdk: Fix the endian problem of buf_len and lba
>
>   block/vmdk.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>

-- 
QingFeng Hao(Robin)

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

* Re: [Qemu-devel] [Qemu-stable] [PATCH v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2016-11-26  5:46 ` [Qemu-devel] [PATCH v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba QingFeng Hao
@ 2016-11-26 11:46   ` Fam Zheng
  2016-11-28  1:51     ` Hao QingFeng
  2016-11-28  7:56   ` [Qemu-devel] " liujing
  1 sibling, 1 reply; 7+ messages in thread
From: Fam Zheng @ 2016-11-26 11:46 UTC (permalink / raw)
  To: QingFeng Hao
  Cc: qemu-devel, qemu-block, kwolf, liujbjl, qemu-stable, borntraeger,
	cornelia.huck

On Sat, 11/26 06:46, 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>
> ---
>  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
> 
> 

Reviewed-by: Fam Zheng <famz@redhat.com>

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

* Re: [Qemu-devel] [Qemu-stable] [PATCH v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2016-11-26 11:46   ` [Qemu-devel] [Qemu-stable] " Fam Zheng
@ 2016-11-28  1:51     ` Hao QingFeng
  0 siblings, 0 replies; 7+ messages in thread
From: Hao QingFeng @ 2016-11-28  1:51 UTC (permalink / raw)
  To: Fam Zheng
  Cc: qemu-devel, qemu-block, kwolf, liujbjl, qemu-stable, borntraeger,
	cornelia.huck



在 2016-11-26 19:46, Fam Zheng 写道:
> On Sat, 11/26 06:46, 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>
>> ---
>>   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
>>
>>
> Reviewed-by: Fam Zheng <famz@redhat.com>
Thanks!

-- 
QingFeng Hao(Robin)

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

* Re: [Qemu-devel] [PATCH v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2016-11-26  5:46 ` [Qemu-devel] [PATCH v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba QingFeng Hao
  2016-11-26 11:46   ` [Qemu-devel] [Qemu-stable] " Fam Zheng
@ 2016-11-28  7:56   ` liujing
  2016-11-28  8:11     ` Hao QingFeng
  1 sibling, 1 reply; 7+ messages in thread
From: liujing @ 2016-11-28  7:56 UTC (permalink / raw)
  To: QingFeng Hao, qemu-devel, qemu-block
  Cc: borntraeger, cornelia.huck, kwolf, qemu-stable

Hi QingFeng,


I just have a question that whether the marker->data
need convert?

I've no idea, just suddenly realized this question.

Jing

On 11/26/2016 01:46 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>
> ---
>   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 v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba
  2016-11-28  7:56   ` [Qemu-devel] " liujing
@ 2016-11-28  8:11     ` Hao QingFeng
  0 siblings, 0 replies; 7+ messages in thread
From: Hao QingFeng @ 2016-11-28  8:11 UTC (permalink / raw)
  To: liujing, qemu-devel, qemu-block
  Cc: borntraeger, cornelia.huck, kwolf, qemu-stable



在 2016-11-28 15:56, liujing 写道:
> Hi QingFeng,
>
>
> I just have a question that whether the marker->data
> need convert?
>
> I've no idea, just suddenly realized this question.
>
nope, the data is type of char * for the compressed data stream, so no 
endian issue.
thanks.
> Jing
>
> On 11/26/2016 01:46 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>
>> ---
>>   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) {
>

-- 
QingFeng Hao(Robin)

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

end of thread, other threads:[~2016-11-28  8:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-26  5:46 [Qemu-devel] [PATCH v2 0/1] qemu: fix the bug reported by qemu-iotests case 055 QingFeng Hao
2016-11-26  5:46 ` [Qemu-devel] [PATCH v2 1/1] block/vmdk: Fix the endian problem of buf_len and lba QingFeng Hao
2016-11-26 11:46   ` [Qemu-devel] [Qemu-stable] " Fam Zheng
2016-11-28  1:51     ` Hao QingFeng
2016-11-28  7:56   ` [Qemu-devel] " liujing
2016-11-28  8:11     ` Hao QingFeng
2016-11-26  5:51 ` [Qemu-devel] [PATCH v2 0/1] qemu: fix the bug reported by qemu-iotests case 055 Hao QingFeng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.