[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/25] replication: Fix replication open fail
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 01/25] replication: Fix replication open fail |
Date: |
Fri, 17 Nov 2017 19:16:29 +0100 |
From: Wang Guang <address@hidden>
replication_child_perm request write
permissions for all child which will lead bdrv_check_perm fail.
replication_child_perm() should request write
permissions only if it is writable itself.
Signed-off-by: Wang Guang <address@hidden>
Signed-off-by: Wang Yong <address@hidden>
Reviewed-by: Xie Changlong <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/replication.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/block/replication.c b/block/replication.c
index 3a4e6822e4..1c95d673ff 100644
--- a/block/replication.c
+++ b/block/replication.c
@@ -161,10 +161,13 @@ static void replication_child_perm(BlockDriverState *bs,
BdrvChild *c,
uint64_t perm, uint64_t shared,
uint64_t *nperm, uint64_t *nshared)
{
- *nperm = *nshared = BLK_PERM_CONSISTENT_READ \
- | BLK_PERM_WRITE \
- | BLK_PERM_WRITE_UNCHANGED;
-
+ *nperm = BLK_PERM_CONSISTENT_READ;
+ if ((bs->open_flags & (BDRV_O_INACTIVE | BDRV_O_RDWR)) == BDRV_O_RDWR) {
+ *nperm |= BLK_PERM_WRITE;
+ }
+ *nshared = BLK_PERM_CONSISTENT_READ \
+ | BLK_PERM_WRITE \
+ | BLK_PERM_WRITE_UNCHANGED;
return;
}
--
2.13.6
- [Qemu-devel] [PULL 00/25] Block layer patches for 2.11.0-rc2, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 02/25] qemu-iotests: Use -nographic in 182, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 03/25] block: Fix error path in bdrv_backing_update_filename(), Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 04/25] qcow2: don't permit changing encryption parameters, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 01/25] replication: Fix replication open fail,
Kevin Wolf <=
- [Qemu-devel] [PULL 05/25] block: Deprecate bdrv_set_read_only() and users, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 07/25] block: Fix permissions in image activation, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 06/25] qcow2: fix image corruption after committing qcow2 image into base, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 13/25] block: qobject_is_equal() in bdrv_reopen_prepare(), Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 08/25] iotests: test clearing unknown autoclear_features by qcow2, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 11/25] qapi/qlist: Add qlist_append_null() macro, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 10/25] qapi/qnull: Add own header, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 09/25] qcow2: fix image corruption on commit with persistent bitmap, Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 12/25] qapi: Add qobject_is_equal(), Kevin Wolf, 2017/11/17
- [Qemu-devel] [PULL 14/25] iotests: Add test for non-string option reopening, Kevin Wolf, 2017/11/17