Skip to contentSkip to conversation

block: Inactivate all nodes at migration source

PATCH In review Fam Zheng 2 participants 3 messages Apr 15, 2016 – Apr 18, 2016

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 block: Inactivate all nodes at migration source

qcow2 is not necessarily the top layer node. Since bdrv_inactivate() doesn't recurse, we should ensure all block nodes are inactivated.

---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
index d4939b4..1c575e4 100644
@@ -3270,7 +3270,7 @@ int bdrv_inactivate_all(void)
     BlockDriverState *bs = NULL;
     int ret;
 
-    while ((bs = bdrv_next(bs)) != NULL) {
+    while ((bs = bdrv_next_node(bs)) != NULL) {
         AioContext *aio_context = bdrv_get_aio_context(bs);
 
         aio_context_acquire(aio_context);
Signature · 1 line
2.8.0
#1 lore raw

Am 15.04.2016 um 05:11 hat Fam Zheng geschrieben:

Quoted 4 lines

qcow2 is not necessarily the top layer node. Since bdrv_inactivate() doesn't recurse, we should ensure all block nodes are inactivated.

Hm, I don't think that's quite right. bdrv_inactivate_all() should be the opposite of bdrv_invalidate_cache_all(), i.e. both operations should affect the same nodes.

Currently, both use bdrv_next(), but bdrv_invalidate_cache() is partially recursive: It is called for bs->file (by block.c if there is no implementation for bs, by the driver implementation otherwise), or for all children in the quorum case, but not for other children like bs->backing or the extents for VMDK.

If you think that that sounds wrong, I'm with you. :-) The question is how to fix it. I think I'd make bdrv_invalidate() recurse to all children and then do the same for bdrv_inactivate().

Kevin

Quoted 19 lines
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
index d4939b4..1c575e4 100644
@@ -3270,7 +3270,7 @@ int bdrv_inactivate_all(void)
     BlockDriverState *bs = NULL;
     int ret;
 
-    while ((bs = bdrv_next(bs)) != NULL) {
+    while ((bs = bdrv_next_node(bs)) != NULL) {
         AioContext *aio_context = bdrv_get_aio_context(bs);
 
         aio_context_acquire(aio_context);
Signature · 1 line
2.8.0
author
#2 lore raw
Quoted 16 lines · Kevin Wolf

Am 15.04.2016 um 05:11 hat Fam Zheng geschrieben:

Quoted 4 lines

qcow2 is not necessarily the top layer node. Since bdrv_inactivate() doesn't recurse, we should ensure all block nodes are inactivated.

Hm, I don't think that's quite right. bdrv_inactivate_all() should be the opposite of bdrv_invalidate_cache_all(), i.e. both operations should affect the same nodes.

Currently, both use bdrv_next(), but bdrv_invalidate_cache() is partially recursive: It is called for bs->file (by block.c if there is no implementation for bs, by the driver implementation otherwise), or for all children in the quorum case, but not for other children like bs->backing or the extents for VMDK.

Quoted 3 lines

If you think that that sounds wrong, I'm with you. :-) The question is how to fix it. I think I'd make bdrv_invalidate() recurse to all children and then do the same for bdrv_inactivate().

That makes sense, I'll try again.

Fam

Quoted 22 lines

Kevin

Quoted 19 lines
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block.c +1 -1
index d4939b4..1c575e4 100644
@@ -3270,7 +3270,7 @@ int bdrv_inactivate_all(void)
     BlockDriverState *bs = NULL;
     int ret;
 
-    while ((bs = bdrv_next(bs)) != NULL) {
+    while ((bs = bdrv_next_node(bs)) != NULL) {
         AioContext *aio_context = bdrv_get_aio_context(bs);
 
         aio_context_acquire(aio_context);
Signature · 1 line
2.8.0