aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
Diffstat (limited to 'block.c')
-rw-r--r--block.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/block.c b/block.c
index bdd33383e8..bb8c067328 100644
--- a/block.c
+++ b/block.c
@@ -3143,14 +3143,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);
}
- return drv->bdrv_is_inserted(bs);
+ QLIST_FOREACH(child, &bs->children, next) {
+ if (!bdrv_is_inserted(child->bs)) {
+ return false;
+ }
+ }
+ return true;
}
/**