[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 19/36] block: Update flags in bdrv_set_read_only()
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 19/36] block: Update flags in bdrv_set_read_only() |
Date: |
Mon, 5 Nov 2018 17:37:27 +0100 |
To fully change the read-only state of a node, we must not only change
bs->read_only, but also update bs->open_flags.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Alberto Garcia <address@hidden>
---
block.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/block.c b/block.c
index 9d2adf7962..3132c78f01 100644
--- a/block.c
+++ b/block.c
@@ -281,6 +281,13 @@ int bdrv_set_read_only(BlockDriverState *bs, bool
read_only, Error **errp)
}
bs->read_only = read_only;
+
+ if (read_only) {
+ bs->open_flags &= ~BDRV_O_RDWR;
+ } else {
+ bs->open_flags |= BDRV_O_RDWR;
+ }
+
return 0;
}
--
2.19.1
- [Qemu-block] [PULL 08/36] qcow2: Get the request alignment for encrypted images from QCryptoBlock, (continued)
- [Qemu-block] [PULL 08/36] qcow2: Get the request alignment for encrypted images from QCryptoBlock, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 09/36] block: change some function return type to bool, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 12/36] block/vhdx: Don't take address of fields in packed structs, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 10/36] iotests: make 083 specific to raw, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 22/36] block: Require auto-read-only for existing fallbacks, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 30/36] option: Make option help nicer to read, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 15/36] quorum: Return an error if the blkverify mode has invalid settings, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 16/36] iotest: Test the blkverify mode of the Quorum driver, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 17/36] quorum: Forbid adding children in blkverify mode, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 31/36] chardev: Indent list of chardevs, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 19/36] block: Update flags in bdrv_set_read_only(),
Kevin Wolf <=
- [Qemu-block] [PULL 18/36] iotest: Test x-blockdev-change on a Quorum, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 23/36] nbd: Support auto-read-only option, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 14/36] quorum: Remove quorum_err(), Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 11/36] vpc: Don't leak opts in vpc_open(), Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 28/36] block: Make auto-read-only=on default for -drive, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 32/36] qdev-monitor: Make device options help nicer, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 35/36] vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 20/36] block: Add auto-read-only option, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 34/36] fw_cfg: Drop newline in @file description, Kevin Wolf, 2018/11/05
- [Qemu-block] [PULL 29/36] qemu-iotests: Test auto-read-only with -drive and -blockdev, Kevin Wolf, 2018/11/05