qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "sochin.jiang" <sochin.jiang@huawei.com>
To: kwolf@redhat.com, mreitz@redhat.com
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
	sochin.jiang@huawei.com, eric.fangyi@huawei.com,
	subo7@huawei.com, xieyingtai@huawei.com, lina.lulina@huawei.com,
	zhangshuai13@huawei.com, lizhengui@huawei.com
Subject: [Qemu-devel] [PATCH] fix: avoid infinite loop when blockjob encountering failure
Date: Wed, 14 Jun 2017 14:22:39 +0800	[thread overview]
Message-ID: <1497421359-32660-1-git-send-email-sochin.jiang@huawei.com> (raw)

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

             reply	other threads:[~2017-06-14  6:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14  6:22 sochin.jiang [this message]
2017-06-14  6:33 ` [Qemu-devel] [PATCH] fix: avoid infinite loop when blockjob encountering failure 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1497421359-32660-1-git-send-email-sochin.jiang@huawei.com \
    --to=sochin.jiang@huawei.com \
    --cc=eric.fangyi@huawei.com \
    --cc=kwolf@redhat.com \
    --cc=lina.lulina@huawei.com \
    --cc=lizhengui@huawei.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=subo7@huawei.com \
    --cc=xieyingtai@huawei.com \
    --cc=zhangshuai13@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).