On 7/25/19 11:27 AM, Kevin Wolf wrote: > Calling bdrv_drained_end() for target_bs can restarts requests too
restart > early, so that they would execute on mirror_top_bs, which however has > already dropped all permissions. > > Keep the target node drained until all graph changes have completed. > > Signed-off-by: Kevin Wolf <[email protected]> > --- > block/mirror.c | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/block/mirror.c b/block/mirror.c > index 8cb75fb409..7483051f8d 100644 > --- a/block/mirror.c > +++ b/block/mirror.c > @@ -644,6 +644,11 @@ static int mirror_exit_common(Job *job) > bdrv_ref(mirror_top_bs); > bdrv_ref(target_bs); > > + /* The mirror job has no requests in flight any more, but we need to > + * drain potential other users of the BDS before changing the graph. */ Is checkpatch going to gripe about your comment style, > + assert(s->in_drain); > + bdrv_drained_begin(target_bs); > + > /* Remove target parent that still uses BLK_PERM_WRITE/RESIZE before > * inserting target_bs at s->to_replace, where we might not be able to > get > * these permissions. > @@ -684,12 +689,7 @@ static int mirror_exit_common(Job *job) > bdrv_reopen_set_read_only(target_bs, ro, NULL); > } > > - /* The mirror job has no requests in flight any more, but we need to > - * drain potential other users of the BDS before changing the graph. > */ even though it is just code motion? -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
