yeahuh / rpms / qemu-kvm

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