[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 05/13] vpc: fix return value check for blk_pwrite
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 05/13] vpc: fix return value check for blk_pwrite |
Date: |
Tue, 12 Apr 2016 18:19:00 +0200 |
From: Paolo Bonzini <address@hidden>
bdrv_pwrite_sync used to return zero or negative error, while blk_pwrite returns
the number of written bytes when successful. This caused VPC image creation
to fail spectacularly: it wrote the first 512 bytes, and then exited immediately
because of the non-zero answer from blk_pwrite. But the truly spectacular part
is that it returns a positive value (the 512 that blk_pwrite returned) causing
everyone to believe that it succeeded.
This fixes qemu-iotests with vpc format.
Fixes: b8f45cdf7827e39f9a1e6cc446f5972cc6144237
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/vpc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/vpc.c b/block/vpc.c
index 8830b5b..3713ec3 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -775,7 +775,7 @@ static int create_dynamic_disk(BlockBackend *blk, uint8_t
*buf,
num_bat_entries = (total_sectors + block_size / 512) / (block_size / 512);
ret = blk_pwrite(blk, offset, buf, HEADER_SIZE);
- if (ret) {
+ if (ret < 0) {
goto fail;
}
--
1.8.3.1
- [Qemu-block] [PULL 00/13] Block patches for 2.6, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 02/13] qemu-img: fix formatting of error message, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 03/13] block: initialize qcrypto API at startup, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 01/13] iotests: fix the broken 026.nocache output, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 04/13] iotests: Make 150 use qemu-img map instead of du, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 08/13] qemu-iotests: check: don't place files with predictable names in /tmp, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 05/13] vpc: fix return value check for blk_pwrite,
Kevin Wolf <=
- [Qemu-block] [PULL 07/13] MAINTAINERS: Block layer core, qcow2 and blkdebug, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 10/13] qemu-iotests: iotests.VM: remove qtest socket on error, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 12/13] qemu-iotests: 068: don't require KVM, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 13/13] qemu-iotests: iotests.py: get rid of __all__, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 09/13] qemu-iotests: fix 051 on non-PC architectures, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 06/13] qcow2: Prevent backing file names longer than 1023, Kevin Wolf, 2016/04/12
- [Qemu-block] [PULL 11/13] qemu-iotests: 148: properly skip test if quorum support is missing, Kevin Wolf, 2016/04/12
- Re: [Qemu-block] [PULL 00/13] Block patches for 2.6, Peter Maydell, 2016/04/13