* Tue Feb 26 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 3.1.0-17.el8

- kvm-block-Apply-auto-read-only-for-ro-whitelist-drivers.patch [bz#1678968]
- Resolves: bz#1678968
  (-blockdev: auto-read-only is ineffective for drivers on read-only whitelist)
This commit is contained in:
Danilo C. L. de Paula 2019-02-26 12:21:07 +00:00
parent dd7d9e5a43
commit dd688447c4
2 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,66 @@
From fa7a2c6b323882bb64d0015b842f05d6078bbe48 Mon Sep 17 00:00:00 2001
From: Kevin Wolf <kwolf@redhat.com>
Date: Wed, 20 Feb 2019 10:37:05 +0000
Subject: [PATCH] block: Apply auto-read-only for ro-whitelist drivers
RH-Author: Kevin Wolf <kwolf@redhat.com>
Message-id: <20190220103705.22630-2-kwolf@redhat.com>
Patchwork-id: 84561
O-Subject: [RHEL-8.0/AV qemu-kvm PATCH 1/1] block: Apply auto-read-only for ro-whitelist drivers
Bugzilla: 1678968
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Max Reitz <mreitz@redhat.com>
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
If QEMU was configured with a driver in --block-drv-ro-whitelist, trying
to use that driver read-write resulted in an error message even if
auto-read-only=on was set.
Consider auto-read-only=on for the whitelist checking and use it to
automatically degrade to read-only for block drivers on the read-only
whitelist.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 8be25de64315ef768353eb61f2b2bf6cddc34230)
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
block.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/block.c b/block.c
index 1ec4512..f1f6924 100644
--- a/block.c
+++ b/block.c
@@ -1442,13 +1442,19 @@ static int bdrv_open_common(BlockDriverState *bs, BlockBackend *file,
bs->read_only = !(bs->open_flags & BDRV_O_RDWR);
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) {
- error_setg(errp,
- !bs->read_only && bdrv_is_whitelisted(drv, true)
- ? "Driver '%s' can only be used for read-only devices"
- : "Driver '%s' is not whitelisted",
- drv->format_name);
- ret = -ENOTSUP;
- goto fail_opts;
+ if (!bs->read_only && bdrv_is_whitelisted(drv, true)) {
+ ret = bdrv_apply_auto_read_only(bs, NULL, NULL);
+ } else {
+ ret = -ENOTSUP;
+ }
+ if (ret < 0) {
+ error_setg(errp,
+ !bs->read_only && bdrv_is_whitelisted(drv, true)
+ ? "Driver '%s' can only be used for read-only devices"
+ : "Driver '%s' is not whitelisted",
+ drv->format_name);
+ goto fail_opts;
+ }
}
/* bdrv_new() and bdrv_close() make it so */
--
1.8.3.1

View File

@ -68,7 +68,7 @@ Obsoletes: %1-rhev
Summary: QEMU is a machine emulator and virtualizer
Name: qemu-kvm
Version: 3.1.0
Release: 16%{?dist}
Release: 17%{?dist}
# Epoch because we pushed a qemu-1.0 package. AIUI this can't ever be dropped
Epoch: 15
License: GPLv2 and GPLv2+ and CC-BY
@ -206,6 +206,8 @@ Patch59: kvm-doc-fix-the-configuration-path.patch
Patch60: kvm-fdc-Revert-downstream-disablement-of-device-floppy.patch
# For bz#1664997 - Restrict floppy device to RHEL-7 machine types
Patch61: kvm-fdc-Restrict-floppy-controllers-to-RHEL-7-machine-ty.patch
# For bz#1678968 - -blockdev: auto-read-only is ineffective for drivers on read-only whitelist
Patch62: kvm-block-Apply-auto-read-only-for-ro-whitelist-drivers.patch
BuildRequires: zlib-devel
BuildRequires: glib2-devel
@ -1098,6 +1100,11 @@ useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
%changelog
* Tue Feb 26 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 3.1.0-17.el8
- kvm-block-Apply-auto-read-only-for-ro-whitelist-drivers.patch [bz#1678968]
- Resolves: bz#1678968
(-blockdev: auto-read-only is ineffective for drivers on read-only whitelist)
* Mon Feb 25 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 3.1.0-16.el8
- kvm-fdc-Revert-downstream-disablement-of-device-floppy.patch [bz#1664997]
- kvm-fdc-Restrict-floppy-controllers-to-RHEL-7-machine-ty.patch [bz#1664997]