yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-mirror-Fix-resource-leak-when-bdrv_getlength-fails.patch

9ae3a8
From 5e30d941f2fb33b995333fc4bb45368129f8d4bc Mon Sep 17 00:00:00 2001
9ae3a8
From: Eric Blake <eblake@redhat.com>
9ae3a8
Date: Wed, 20 Aug 2014 16:40:08 +0200
9ae3a8
Subject: [PATCH 05/11] mirror: Fix resource leak when bdrv_getlength fails
9ae3a8
9ae3a8
Message-id: <1408552814-23031-2-git-send-email-eblake@redhat.com>
9ae3a8
Patchwork-id: 60646
9ae3a8
O-Subject: [qemu-kvm-rhev 7.0.z PATCH 1/7] mirror: Fix resource leak when bdrv_getlength fails
9ae3a8
Bugzilla: 1130603
9ae3a8
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
9ae3a8
The direct return will skip releasing of all the resouces at
9ae3a8
immediate_exit, don't miss that.
9ae3a8
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 373df5b135b4a54e0abb394e9e703fef3ded093c)
9ae3a8
Signed-off-by: Eric Blake <eblake@redhat.com>
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 block/mirror.c |    4 ++--
9ae3a8
 1 files changed, 2 insertions(+), 2 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/mirror.c b/block/mirror.c
9ae3a8
index 47e14cd..9b3e229 100644
9ae3a8
--- a/block/mirror.c
9ae3a8
+++ b/block/mirror.c
9ae3a8
@@ -307,8 +307,8 @@ static void coroutine_fn mirror_run(void *opaque)
9ae3a8
 
9ae3a8
     s->common.len = bdrv_getlength(bs);
9ae3a8
     if (s->common.len <= 0) {
9ae3a8
-        block_job_completed(&s->common, s->common.len);
9ae3a8
-        return;
9ae3a8
+        ret = s->common.len;
9ae3a8
+        goto immediate_exit;
9ae3a8
     }
9ae3a8
 
9ae3a8
     length = (bdrv_getlength(bs) + s->granularity - 1) / s->granularity;
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8