On Wed, Apr 11, 2018 at 06:39:30PM +0200, Kevin Wolf wrote: > +static void do_test_delete_by_drain(bool detach_instead_of_delete) > +{ > + BlockBackend *blk; > + BlockDriverState *bs, *child_bs, *null_bs; > + BDRVTestTopState *tts; > + TestCoDeleteByDrainData dbdd; > + Coroutine *co; > + > + bs = bdrv_new_open_driver(&bdrv_test_top_driver, "top", BDRV_O_RDWR, > + &error_abort); > + bs->total_sectors = 65536 >> BDRV_SECTOR_BITS; > + tts = bs->opaque; > + > + null_bs = bdrv_open("null-co://", NULL, NULL, BDRV_O_RDWR | > BDRV_O_PROTOCOL, > + &error_abort); > + bdrv_attach_child(bs, null_bs, "null-child", &child_file, &error_abort); > + > + /* This child will be the one to pass to requests through to, and > + * it will stall until a drain occurs */ > + child_bs = bdrv_new_open_driver(&bdrv_test, "child", BDRV_O_RDWR, > + &error_abort); > + child_bs->total_sectors = 65536 >> BDRV_SECTOR_BITS; > + /* Takes our reference to child_bs */ > + tts->wait_child = bdrv_attach_child(bs, child_bs, "wait-child", > &child_file, > + &error_abort); > + > + /* This child is just there to be deleted > + * (for detach_instead_of_delete == true) */ > + null_bs = bdrv_open("null-co://", NULL, NULL, BDRV_O_RDWR | > BDRV_O_PROTOCOL, > + &error_abort); > + bdrv_attach_child(bs, null_bs, "null-child", &child_file, &error_abort);
Why is null_bs created twice (with the exact same "null-child" name)? I'm surprised that bdrv_attach_child() succeeds with a duplicate name. Anyway, I find the duplicate null_bs confusing and I'm not sure if it's a copy-paste mistake.
signature.asc
Description: PGP signature