On 11/04/2018 18:39, Kevin Wolf wrote:
> + if (atomic_read(&bs->in_flight)) {
> + return true;
> + }
> +
> + if (recursive) {
> + QLIST_FOREACH_SAFE(child, &bs->children, next, next) {
QLIST_FOREACH_SAFE is only safe if child disappears, but not if e.g.
next disappears. So this loop is only safe because top_level is false
below. Sounds like another good reason to split the top_level == false
case into a separate function.
Paolo
> + if (bdrv_drain_poll(child->bs, false, recursive)) {
> + return true;
> + }
> + }