]> git.proxmox.com Git - mirror_qemu.git/blobdiff - block.c
block: Use children list in bdrv_refresh_filename
[mirror_qemu.git] / block.c
diff --git a/block.c b/block.c
index 88aa687a6808ac3f1caa036e6feef112556cf1ae..d97f5e708480b70b994b81f82696f27888e2aaca 100644 (file)
--- a/block.c
+++ b/block.c
@@ -5536,16 +5536,17 @@ static bool append_open_options(QDict *d, BlockDriverState *bs)
 void bdrv_refresh_filename(BlockDriverState *bs)
 {
     BlockDriver *drv = bs->drv;
+    BdrvChild *child;
     QDict *opts;
 
     if (!drv) {
         return;
     }
 
-    /* This BDS's file name will most probably depend on its file's name, so
-     * refresh that first */
-    if (bs->file) {
-        bdrv_refresh_filename(bs->file->bs);
+    /* This BDS's file name may depend on any of its children's file names, so
+     * refresh those first */
+    QLIST_FOREACH(child, &bs->children, next) {
+        bdrv_refresh_filename(child->bs);
     }
 
     if (drv->bdrv_refresh_filename) {