On 29.09.2015 11:15, Alberto Garcia wrote: > On Fri 18 Sep 2015 05:22:42 PM CEST, Max Reitz wrote: >> If bdrv_is_inserted() is called on the top level BDS, it should make >> sure all nodes in the BDS tree are actually inserted. >> >> Signed-off-by: Max Reitz >> --- >> block.c | 12 +++++++++--- >> 1 file changed, 9 insertions(+), 3 deletions(-) >> >> diff --git a/block.c b/block.c >> index 4a089e6..c4fa299 100644 >> --- a/block.c >> +++ b/block.c >> @@ -3247,14 +3247,20 @@ void bdrv_invalidate_cache_all(Error **errp) >> bool bdrv_is_inserted(BlockDriverState *bs) >> { >> BlockDriver *drv = bs->drv; >> + BdrvChild *child; >> >> if (!drv) { >> return false; >> } >> - if (!drv->bdrv_is_inserted) { >> - return true; >> + if (drv->bdrv_is_inserted) { >> + return drv->bdrv_is_inserted(bs); >> } > > If there's drv->bdrv_is_inserted then this code stops here and does not > iterate the children, is this correct? Yes, that is how it's supposed to be. Max >> - return drv->bdrv_is_inserted(bs); >> + QLIST_FOREACH(child, &bs->children, next) { >> + if (!bdrv_is_inserted(child->bs)) { >> + return false; >> + } >> + } >> + return true; >> } > > Berto >