[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 5/6] block: reopen: Queue children after their paren
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH 5/6] block: reopen: Queue children after their parents |
Date: |
Fri, 15 Sep 2017 12:10:07 +0200 |
We will calculate the required new permissions in the prepare stage of a
reopen. Required permissions of children can be influenced by the
changes made to their parents, but parents are independent from their
children. This means that permissions need to be calculated top-down. In
order to achieve this, queue parents before their children rather than
queuing the children first.
Signed-off-by: Kevin Wolf <address@hidden>
---
block.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/block.c b/block.c
index ed8d51dd42..204cbb46c7 100644
--- a/block.c
+++ b/block.c
@@ -2768,6 +2768,19 @@ static BlockReopenQueue
*bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
flags |= BDRV_O_ALLOW_RDWR;
}
+ if (!bs_entry) {
+ bs_entry = g_new0(BlockReopenQueueEntry, 1);
+ QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
+ } else {
+ QDECREF(bs_entry->state.options);
+ QDECREF(bs_entry->state.explicit_options);
+ }
+
+ bs_entry->state.bs = bs;
+ bs_entry->state.options = options;
+ bs_entry->state.explicit_options = explicit_options;
+ bs_entry->state.flags = flags;
+
QLIST_FOREACH(child, &bs->children, next) {
QDict *new_child_options;
char *child_key_dot;
@@ -2787,19 +2800,6 @@ static BlockReopenQueue
*bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
child->role, options, flags);
}
- if (!bs_entry) {
- bs_entry = g_new0(BlockReopenQueueEntry, 1);
- QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
- } else {
- QDECREF(bs_entry->state.options);
- QDECREF(bs_entry->state.explicit_options);
- }
-
- bs_entry->state.bs = bs;
- bs_entry->state.options = options;
- bs_entry->state.explicit_options = explicit_options;
- bs_entry->state.flags = flags;
-
return bs_queue;
}
--
2.13.5
- Re: [Qemu-block] [PATCH 1/6] qemu-io: Reset qemuio_blk permissions before each command, (continued)
- [Qemu-block] [PATCH 3/6] block: Add reopen queue to bdrv_check_perm(), Kevin Wolf, 2017/09/15
- [Qemu-block] [PATCH 4/6] block: Base permissions on rw state after reopen, Kevin Wolf, 2017/09/15
- [Qemu-block] [PATCH 2/6] block: Add reopen_queue to bdrv_child_perm(), Kevin Wolf, 2017/09/15
- [Qemu-block] [PATCH 5/6] block: reopen: Queue children after their parents,
Kevin Wolf <=
- [Qemu-block] [PATCH 6/6] block: Fix permissions after bdrv_reopen(), Kevin Wolf, 2017/09/15
- [Qemu-block] [PATCH 7/6] qemu-iotests: Test change-backing-file command, Kevin Wolf, 2017/09/15
- Re: [Qemu-block] [PATCH 0/6] block: Fix permissions after ro/rw reopen, Fam Zheng, 2017/09/18