yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-block-Fix-update-of-BDRV_O_AUTO_RDONLY-in-update_fla.patch

26ba25
From be690258db5ef9b4b80dd1d24d8a275ffc36f84c Mon Sep 17 00:00:00 2001
26ba25
From: Kevin Wolf <kwolf@redhat.com>
26ba25
Date: Thu, 10 Jan 2019 12:44:42 +0000
26ba25
Subject: [PATCH 12/14] block: Fix update of BDRV_O_AUTO_RDONLY in
26ba25
 update_flags_from_options()
26ba25
26ba25
RH-Author: Kevin Wolf <kwolf@redhat.com>
26ba25
Message-id: <20190110124442.30132-13-kwolf@redhat.com>
26ba25
Patchwork-id: 83960
26ba25
O-Subject: [RHEL-8.0 qemu-kvm PATCH 12/12] block: Fix update of BDRV_O_AUTO_RDONLY in update_flags_from_options()
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: Eric Blake <eblake@redhat.com>
26ba25
26ba25
From: Alberto Garcia <berto@igalia.com>
26ba25
26ba25
Commit e35bdc123a4ace9f4d3fcca added the auto-read-only option and the
26ba25
code to update its corresponding flag in update_flags_from_options(),
26ba25
but forgot to clear the flag if auto-read-only is false.
26ba25
26ba25
Signed-off-by: Alberto Garcia <berto@igalia.com>
26ba25
Reported-by: Max Reitz <mreitz@redhat.com>
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
(cherry picked from commit 2a3d4331fa2d40708188b8000f98ff1f7dcd33bc)
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 block.c | 4 +---
26ba25
 1 file changed, 1 insertion(+), 3 deletions(-)
26ba25
26ba25
diff --git a/block.c b/block.c
26ba25
index 268debe..d0f0dc6 100644
26ba25
--- a/block.c
26ba25
+++ b/block.c
26ba25
@@ -1112,7 +1112,7 @@ static int bdrv_open_flags(BlockDriverState *bs, int flags)
26ba25
 
26ba25
 static void update_flags_from_options(int *flags, QemuOpts *opts)
26ba25
 {
26ba25
-    *flags &= ~BDRV_O_CACHE_MASK;
26ba25
+    *flags &= ~(BDRV_O_CACHE_MASK | BDRV_O_RDWR | BDRV_O_AUTO_RDONLY);
26ba25
 
26ba25
     assert(qemu_opt_find(opts, BDRV_OPT_CACHE_NO_FLUSH));
26ba25
     if (qemu_opt_get_bool(opts, BDRV_OPT_CACHE_NO_FLUSH, false)) {
26ba25
@@ -1124,8 +1124,6 @@ static void update_flags_from_options(int *flags, QemuOpts *opts)
26ba25
         *flags |= BDRV_O_NOCACHE;
26ba25
     }
26ba25
 
26ba25
-    *flags &= ~BDRV_O_RDWR;
26ba25
-
26ba25
     assert(qemu_opt_find(opts, BDRV_OPT_READ_ONLY));
26ba25
     if (!qemu_opt_get_bool(opts, BDRV_OPT_READ_ONLY, false)) {
26ba25
         *flags |= BDRV_O_RDWR;
26ba25
-- 
26ba25
1.8.3.1
26ba25