qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-devel@nongnu.org, qemu-block@nongnu.org
Cc: vsementsov@virtuozzo.com, stefanha@redhat.com, famz@redhat.com,
	mreitz@redhat.com, jcody@redhat.com, kwolf@redhat.com,
	den@openvz.org
Subject: [Qemu-devel] [PATCH 3/3] blockjob: fix transaction cancel
Date: Wed, 27 Jul 2016 13:49:50 +0300	[thread overview]
Message-ID: <1469616590-38683-4-git-send-email-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <1469616590-38683-1-git-send-email-vsementsov@virtuozzo.com>

Prevent a situation, when some jobs from transaction are already
finished and user tries to cancel a job from this transaction.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 blockdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index 59ae9e4..d1818c2 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -3772,6 +3772,17 @@ void qmp_block_job_cancel(const char *device,
         goto out;
     }
 
+    if (block_job_txn_all_success(job)) {
+        if (job->txn != NULL) {
+            error_setg(errp, "All block jobs in transaction for device '%s' are"
+                             "already successed", device);
+        } else {
+            error_setg(errp, "The block job for device '%s' is"
+                             "already successed", device);
+        }
+        goto out;
+    }
+
     trace_qmp_block_job_cancel(job);
     block_job_cancel(job);
 out:
-- 
1.8.3.1

      parent reply	other threads:[~2016-07-27 10:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 10:49 [Qemu-devel] [PATCH RFC 0/3] Backup/blockjob fixes Vladimir Sementsov-Ogievskiy
2016-07-27 10:49 ` [Qemu-devel] [PATCH 1/3] blockjob: fix dead pointer in txn list Vladimir Sementsov-Ogievskiy
2016-08-01 22:39   ` [Qemu-devel] [Qemu-block] " John Snow
2016-08-02 11:05     ` Vladimir Sementsov-Ogievskiy
2016-08-02 16:50       ` John Snow
2016-07-27 10:49 ` [Qemu-devel] [PATCH 2/3] backup: fix transaction fail scenario Vladimir Sementsov-Ogievskiy
2016-07-27 10:49 ` Vladimir Sementsov-Ogievskiy [this message]

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=1469616590-38683-4-git-send-email-vsementsov@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=famz@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).