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

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