[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 25/37] qemu-img: add check for zero-length job len
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 25/37] qemu-img: add check for zero-length job len |
Date: |
Thu, 5 Nov 2015 19:17:53 +0100 |
From: John Snow <address@hidden>
The mirror job doesn't update its total length until
it has already started running, so we should translate
a zero-length job-len as meaning 0%.
Otherwise, we may get divide-by-zero faults.
Signed-off-by: John Snow <address@hidden>
Reviewed-by: Jeff Cody <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
qemu-img.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/qemu-img.c b/qemu-img.c
index 3025776..9831db7 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -656,7 +656,8 @@ static void run_block_job(BlockJob *job, Error **errp)
do {
aio_poll(aio_context, true);
- qemu_progress_print((float)job->offset / job->len * 100.f, 0);
+ qemu_progress_print(job->len ?
+ ((float)job->offset / job->len * 100.f) : 0.0f, 0);
} while (!job->ready);
block_job_complete_sync(job, errp);
--
1.8.3.1
- [Qemu-devel] [PULL 10/37] blockdev: Implement change with basic operations, (continued)
- [Qemu-devel] [PULL 10/37] blockdev: Implement change with basic operations, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 14/37] blockdev: read-only-mode for blockdev-change-medium, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 19/37] block: support passing 'backing': '' to 'blockdev-add', Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 12/37] qmp: Introduce blockdev-change-medium, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 17/37] block: check for existing device IDs in external_snapshot_prepare(), Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 18/37] block: rename BlockdevSnapshot to BlockdevSnapshotSync, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 22/37] commit: reopen overlay_bs before base, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 21/37] block: add tests for the 'blockdev-snapshot' command, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 26/37] throttle: Check for pending requests in throttle_group_unregister_bs(), Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 23/37] qemu-iotests: Test the reopening of overlay_bs in 'block-commit', Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 25/37] qemu-img: add check for zero-length job len,
Kevin Wolf <=
- [Qemu-devel] [PULL 24/37] qcow2: avoid misaligned 64bit bswap, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 27/37] throttle: Use bs->throttle_state instead of bs->io_limits_enabled, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 20/37] block: add a 'blockdev-snapshot' QMP command, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 16/37] iotests: Add test for change-related QMP commands, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 28/37] block: Disallow snapshots if the overlay doesn't support backing files, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 29/37] block: Remove inner quotation marks in iotest 085, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 34/37] block: Add blk_get_refcnt(), Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 31/37] qemu-iotests: fix cleanup of background processes, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 30/37] block: test 'blockdev-snapshot' using a file BDS as the overlay, Kevin Wolf, 2015/11/05
- [Qemu-devel] [PULL 32/37] qemu-iotests: fix -valgrind option for check, Kevin Wolf, 2015/11/05