qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-block] [PATCH] fix: avoid infinite loop when blockjob encountering


From: sochin.jiang
Subject: [Qemu-block] [PATCH] fix: avoid infinite loop when blockjob encountering failure
Date: Wed, 14 Jun 2017 14:22:39 +0800

From: "sochin.jiang" <address@hidden>

img_commit could fall into infinite loop if it's blockjob

fail encountering any I/O error. Try to fix it.

Signed-off-by: sochin.jiang <address@hidden>
---
 qemu-img.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/qemu-img.c b/qemu-img.c
index 0ad698d..6ba565d 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -895,8 +895,11 @@ static void run_block_job(BlockJob *job, Error **errp)
         aio_poll(aio_context, true);
         qemu_progress_print(job->len ?
                             ((float)job->offset / job->len * 100.f) : 0.0f, 0);
-    } while (!job->ready);
+    } while (!job->ready && !job->ret);
 
+    if (job->ret) {
+        return;
+    }
     block_job_complete_sync(job, errp);
     aio_context_release(aio_context);
 
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]