[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 05/21] quorum: Fix child permissions
From: |
Max Reitz |
Subject: |
[PATCH v3 05/21] quorum: Fix child permissions |
Date: |
Thu, 30 Jan 2020 22:44:15 +0100 |
Quorum cannot share WRITE or RESIZE on its children. Presumably, it
only does so because as a filter, it seemed intuitively correct to point
its .bdrv_child_perm to bdrv_filter_default_perm().
However, it is not really a filter, and bdrv_filter_default_perm() does
not work for it, so we have to provide a custom .bdrv_child_perm
implementation.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
---
block/quorum.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/block/quorum.c b/block/quorum.c
index df68adcfaa..17b439056f 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -1114,6 +1114,23 @@ static char *quorum_dirname(BlockDriverState *bs, Error
**errp)
return NULL;
}
+static void quorum_child_perm(BlockDriverState *bs, BdrvChild *c,
+ const BdrvChildRole *role,
+ BlockReopenQueue *reopen_queue,
+ uint64_t perm, uint64_t shared,
+ uint64_t *nperm, uint64_t *nshared)
+{
+ *nperm = perm & DEFAULT_PERM_PASSTHROUGH;
+
+ /*
+ * We cannot share RESIZE or WRITE, as this would make the
+ * children differ from each other.
+ */
+ *nshared = (shared & (BLK_PERM_CONSISTENT_READ |
+ BLK_PERM_WRITE_UNCHANGED))
+ | DEFAULT_PERM_UNCHANGED;
+}
+
static const char *const quorum_strong_runtime_opts[] = {
QUORUM_OPT_VOTE_THRESHOLD,
QUORUM_OPT_BLKVERIFY,
@@ -1143,7 +1160,7 @@ static BlockDriver bdrv_quorum = {
.bdrv_add_child = quorum_add_child,
.bdrv_del_child = quorum_del_child,
- .bdrv_child_perm = bdrv_filter_default_perms,
+ .bdrv_child_perm = quorum_child_perm,
.is_filter = true,
.bdrv_recurse_is_first_non_filter = quorum_recurse_is_first_non_filter,
--
2.24.1
- [PATCH v3 00/21] block: Fix check_to_replace_node(), Max Reitz, 2020/01/30
- [PATCH v3 02/21] blockdev: Allow resizing everywhere, Max Reitz, 2020/01/30
- [PATCH v3 01/21] blockdev: Allow external snapshots everywhere, Max Reitz, 2020/01/30
- [PATCH v3 04/21] iotests: Let 041 use -blockdev for quorum children, Max Reitz, 2020/01/30
- [PATCH v3 03/21] block: Drop bdrv_is_first_non_filter(), Max Reitz, 2020/01/30
- [PATCH v3 05/21] quorum: Fix child permissions,
Max Reitz <=
- [PATCH v3 07/21] blkverify: Implement .bdrv_recurse_can_replace(), Max Reitz, 2020/01/30
- [PATCH v3 06/21] block: Add bdrv_recurse_can_replace(), Max Reitz, 2020/01/30
- [PATCH v3 08/21] quorum: Store children in own structure, Max Reitz, 2020/01/30
- [PATCH v3 09/21] quorum: Add QuorumChild.to_be_replaced, Max Reitz, 2020/01/30
- [PATCH v3 10/21] quorum: Implement .bdrv_recurse_can_replace(), Max Reitz, 2020/01/30
- [PATCH v3 11/21] block: Use bdrv_recurse_can_replace(), Max Reitz, 2020/01/30
- [PATCH v3 12/21] block: Remove bdrv_recurse_is_first_non_filter(), Max Reitz, 2020/01/30
- [PATCH v3 13/21] mirror: Double-check immediately before replacing, Max Reitz, 2020/01/30
- [PATCH v3 14/21] quorum: Stop marking it as a filter, Max Reitz, 2020/01/30
- [PATCH v3 16/21] iotests: Add VM.assert_block_path(), Max Reitz, 2020/01/30