Blame SOURCES/kvm-block-Update-flags-in-bdrv_set_read_only.patch

7711c0
From 0e48a34df1ebd61f5fd0e914d638de2646b09635 Mon Sep 17 00:00:00 2001
7711c0
From: Kevin Wolf <kwolf@redhat.com>
7711c0
Date: Fri, 23 Nov 2018 10:41:43 +0100
7711c0
Subject: [PATCH 02/34] block: Update flags in bdrv_set_read_only()
7711c0
7711c0
RH-Author: Kevin Wolf <kwolf@redhat.com>
7711c0
Message-id: <20181123104154.13541-2-kwolf@redhat.com>
7711c0
Patchwork-id: 83110
7711c0
O-Subject: [RHEL-7.7/7.6.z qemu-kvm-rhev PATCH v2 01/12] block: Update flags in bdrv_set_read_only()
7711c0
Bugzilla: 1623986
7711c0
RH-Acked-by: Max Reitz <mreitz@redhat.com>
7711c0
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
RH-Acked-by: John Snow <jsnow@redhat.com>
7711c0
7711c0
To fully change the read-only state of a node, we must not only change
7711c0
bs->read_only, but also update bs->open_flags.
7711c0
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Reviewed-by: Eric Blake <eblake@redhat.com>
7711c0
Reviewed-by: Alberto Garcia <berto@igalia.com>
7711c0
(cherry picked from commit eeae6a596b0efc092f5101c67683053e245e6250)
7711c0
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 block.c | 7 +++++++
7711c0
 1 file changed, 7 insertions(+)
7711c0
7711c0
diff --git a/block.c b/block.c
7711c0
index fbd569c..d3ea21a 100644
7711c0
--- a/block.c
7711c0
+++ b/block.c
7711c0
@@ -281,6 +281,13 @@ int bdrv_set_read_only(BlockDriverState *bs, bool read_only, Error **errp)
7711c0
     }
7711c0
 
7711c0
     bs->read_only = read_only;
7711c0
+
7711c0
+    if (read_only) {
7711c0
+        bs->open_flags &= ~BDRV_O_RDWR;
7711c0
+    } else {
7711c0
+        bs->open_flags |= BDRV_O_RDWR;
7711c0
+    }
7711c0
+
7711c0
     return 0;
7711c0
 }
7711c0
 
7711c0
-- 
7711c0
1.8.3.1
7711c0