qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fix: avoid infinite loop when blockjob encountering failure
@ 2017-06-14  6:22 sochin.jiang
  2017-06-14  6:33 ` no-reply
  2017-06-14 13:12 ` Max Reitz
  0 siblings, 2 replies; 8+ messages in thread
From: sochin.jiang @ 2017-06-14  6:22 UTC (permalink / raw)
  To: kwolf, mreitz
  Cc: qemu-block, qemu-devel, sochin.jiang, eric.fangyi, subo7,
	xieyingtai, lina.lulina, zhangshuai13, lizhengui

From: "sochin.jiang" <sochin.jiang@huawei.com>

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 <sochin.jiang@huawei.com>
---
 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

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

end of thread, other threads:[~2017-06-16 13:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-14  6:22 [Qemu-devel] [PATCH] fix: avoid infinite loop when blockjob encountering failure sochin.jiang
2017-06-14  6:33 ` no-reply
2017-06-14  6:46   ` Fam Zheng
2017-06-14  6:58     ` sochin.jiang
2017-06-14 13:12 ` Max Reitz
2017-06-15  2:38   ` sochin.jiang
2017-06-15  3:24     ` sochin.jiang
2017-06-16 13:06     ` Max Reitz

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