26ba25
From e39d1867ceea7910937bf8bfbd9491e33dc26111 Mon Sep 17 00:00:00 2001
26ba25
From: Kevin Wolf <kwolf@redhat.com>
26ba25
Date: Thu, 10 Jan 2019 12:44:33 +0000
26ba25
Subject: [PATCH 03/14] rbd: Close image in qemu_rbd_open() error path
26ba25
MIME-Version: 1.0
26ba25
Content-Type: text/plain; charset=UTF-8
26ba25
Content-Transfer-Encoding: 8bit
26ba25
26ba25
RH-Author: Kevin Wolf <kwolf@redhat.com>
26ba25
Message-id: <20190110124442.30132-4-kwolf@redhat.com>
26ba25
Patchwork-id: 83951
26ba25
O-Subject: [RHEL-8.0 qemu-kvm PATCH 03/12] rbd: Close image in qemu_rbd_open() error path
26ba25
Bugzilla: 1644996
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
26ba25
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
26ba25
RH-Acked-by: Eric Blake <eblake@redhat.com>
26ba25
26ba25
Commit e2b8247a322 introduced an error path in qemu_rbd_open() after
26ba25
calling rbd_open(), but neglected to close the image again in this error
26ba25
path. The error path should contain everything that the regular close
26ba25
function qemu_rbd_close() contains.
26ba25
26ba25
This adds the missing rbd_close() call.
26ba25
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Reviewed-by: Eric Blake <eblake@redhat.com>
26ba25
(cherry picked from commit a51b9c4862c29f427931f45ee1d39ac1663ba859)
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 block/rbd.c | 1 +
26ba25
 1 file changed, 1 insertion(+)
26ba25
26ba25
diff --git a/block/rbd.c b/block/rbd.c
26ba25
index ebe0701..dc369d0 100644
26ba25
--- a/block/rbd.c
26ba25
+++ b/block/rbd.c
26ba25
@@ -780,6 +780,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
26ba25
                          "automatically marking the image read-only.");
26ba25
             r = bdrv_set_read_only(bs, true, &local_err);
26ba25
             if (r < 0) {
26ba25
+                rbd_close(s->image);
26ba25
                 error_propagate(errp, local_err);
26ba25
                 goto failed_open;
26ba25
             }
26ba25
-- 
26ba25
1.8.3.1
26ba25