From: Denis V. Lunev <[email protected]>

bdrv_replace_child_bs() compares the sizes of the old and the new node
to decide whether @child has to be told, and then notifies every parent
of new_bs. The other parents already had that node and its size, so
they get a resize event for nothing: a scsi-hd sharing the new node
reports CAPACITY DATA HAS CHANGED to its guest although the capacity is
the same.

Notify @child alone. bdrv_parent_cb_resize() has no user left, so drop
it.

Fixes: 8b267376df87 ("block: notify the parent when a replaced child has a 
different size")
Suggested-by: Kevin Wolf <[email protected]>
Signed-off-by: Denis V. Lunev <[email protected]>
Cc: Kevin Wolf <[email protected]>
Cc: Hanna Reitz <[email protected]>
Cc: Eric Blake <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
---
 block.c                      | 2 +-
 include/block/block_int-io.h | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/block.c b/block.c
index 9df1a48c06..c3e7059556 100644
--- a/block.c
+++ b/block.c
@@ -5590,7 +5590,7 @@ int bdrv_replace_child_bs(BdrvChild *child, 
BlockDriverState *new_bs,
         int64_t new_len = bdrv_getlength(new_bs);
 
         if (new_len >= 0 && new_len != old_len) {
-            bdrv_parent_cb_resize(new_bs);
+            bdrv_child_notify_resize(child);
         }
     }
 
diff --git a/include/block/block_int-io.h b/include/block/block_int-io.h
index 3cb72fecd4..6aa7b2184e 100644
--- a/include/block/block_int-io.h
+++ b/include/block/block_int-io.h
@@ -206,7 +206,4 @@ bdrv_co_child_notify_resize(BdrvChild *c);
 void co_wrapper_bdrv_rdlock
 bdrv_child_notify_resize(BdrvChild *c);
 
-void co_wrapper_bdrv_rdlock
-bdrv_parent_cb_resize(BlockDriverState *bs);
-
 #endif /* BLOCK_INT_IO_H */
-- 
2.53.0


Reply via email to