On 09/15/2017 05:10 AM, Kevin Wolf wrote: > If we switch between read-only and read-write, the permissions that > image format drivers need on bs->file change, too. Make sure to update > the permissions during bdrv_reopen(). > > Signed-off-by: Kevin Wolf > --- > include/block/block.h | 1 + > block.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 65 insertions(+) > > +static BlockReopenQueueEntry *find_parent_in_reopen_queue(BlockReopenQueue *q, > + BdrvChild *c) > +{ > + BlockReopenQueueEntry *entry; > + > + QSIMPLEQ_FOREACH(entry, q, entry) { > + BlockDriverState *bs = entry->state.bs; > + BdrvChild *child; > + > + QLIST_FOREACH(child, &bs->children, next) { > + if (child == c) { > + return entry; An O(n^2) loop. Is it going to bite us at any point in the future, or are we generally dealing with a small enough queue size and BDS graph to not worry about it? Reviewed-by: Eric Blake -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org