yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
26ba25
From 03d1ed6853d936e90ed1661433f822b4a360e5fa Mon Sep 17 00:00:00 2001
26ba25
From: Kevin Wolf <kwolf@redhat.com>
26ba25
Date: Thu, 10 Jan 2019 12:44:31 +0000
26ba25
Subject: [PATCH 01/14] block: Update flags in bdrv_set_read_only()
26ba25
26ba25
RH-Author: Kevin Wolf <kwolf@redhat.com>
26ba25
Message-id: <20190110124442.30132-2-kwolf@redhat.com>
26ba25
Patchwork-id: 83949
26ba25
O-Subject: [RHEL-8.0 qemu-kvm PATCH 01/12] block: Update flags in bdrv_set_read_only()
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
To fully change the read-only state of a node, we must not only change
26ba25
bs->read_only, but also update bs->open_flags.
26ba25
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Reviewed-by: Eric Blake <eblake@redhat.com>
26ba25
Reviewed-by: Alberto Garcia <berto@igalia.com>
26ba25
(cherry picked from commit eeae6a596b0efc092f5101c67683053e245e6250)
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 | 7 +++++++
26ba25
 1 file changed, 7 insertions(+)
26ba25
26ba25
diff --git a/block.c b/block.c
26ba25
index 73f55a1..6f1d53b 100644
26ba25
--- a/block.c
26ba25
+++ b/block.c
26ba25
@@ -281,6 +281,13 @@ int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
26ba25
     }
26ba25
 
26ba25
     bs->read_only = read_only;
26ba25
+
26ba25
+    if (read_only) {
26ba25
+        bs->open_flags &= ~BDRV_O_RDWR;
26ba25
+    } else {
26ba25
+        bs->open_flags |= BDRV_O_RDWR;
26ba25
+    }
26ba25
+
26ba25
     return 0;
26ba25
 }
26ba25
 
26ba25
-- 
26ba25
1.8.3.1
26ba25