On 10/11/2017 18:25, Max Reitz wrote:
> if (bs) {
> + bdrv_ref(bs);
> + bdrv_unref(old_bs);
> return bs;
> }
Maybe instead goto...
> it->phase = BDRV_NEXT_MONITOR_OWNED;
> + } else {
> + old_bs = it->bs;
> }
>
> /* Then return the monitor-owned BDSes without a BB attached. Ignore all
> @@ -467,18 +483,46 @@ BlockDriverState *bdrv_next(BdrvNextIterator *it)
> bs = it->bs;
> } while (bs && bdrv_has_blk(bs));
... here?
Paolo
> + if (bs) {
> + bdrv_ref(bs);
> + }
> + bdrv_unref(old_bs);
> +
> return bs;