yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-rbd-Close-image-in-qemu_rbd_open-error-path.patch

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