Skip to contentSkip to conversation

block/quorum.c: Decrease child index when del_child

PATCH In review Zhang Chen 3 participants 5 messages Jun 1, 2020 – Jun 2, 2020 Block layer

lore
Share & tools
lore

Zhang Chen

author
#0 lore raw

PATCH 1/1 block/quorum.c: Decrease child index when del_child

From: Zhang Chen <[email protected]>

Fix this bug:
colo: Can not recover colo after svm failover twice
https://bugs.launchpad.net/bugs/1881231

The child index still be hold when it be deleted, the max num is 32.

---
 block/quorum.c | 1 +
 1 file changed, 1 insertion(+)
block/quorum.c +1 -0
index 7cf7ab1546..f71bd4e19d 100644
@@ -1099,6 +1099,7 @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child,
             (s->num_children - i - 1) * sizeof(BdrvChild *));
     s->children = g_renew(BdrvChild *, s->children, --s->num_children);
     bdrv_unref_child(bs, child);
+    s->next_child_index--;
 
     bdrv_drained_end(bs);
 }
Signature · 1 line
2.17.1
#1 lore raw
Quoted 19 lines · Zhang Chen

From: Zhang Chen <[email protected]>

Fix this bug:
colo: Can not recover colo after svm failover twice
https://bugs.launchpad.net/bugs/1881231

The child index still be hold when it be deleted, the max num is 32.

---
 block/quorum.c | 1 +
 1 file changed, 1 insertion(+)
block/quorum.c +0 -0
index 7cf7ab1546..f71bd4e19d 100644

block/quorum.c static void quorum_del_child(BlockDriverState *bs, BdrvChild *child, · line 1105

Quoted 7 lines
block/quorum.c +1 -0
@@ -1099,6 +1099,7 @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child,
             (s->num_children - i - 1) * sizeof(BdrvChild *));
     s->children = g_renew(BdrvChild *, s->children, --s->num_children);
     bdrv_unref_child(bs, child);
+    s->next_child_index--;
 
     bdrv_drained_end(bs);
 }

As I explained a few weeks ago this patch is not correct. quorum_del_child() allows you to remove any child from the Quorum device, so nothing guarantees that next_child_index-1 is free.

https://lists.gnu.org/archive/html/qemu-block/2020-05/msg00634.html

Berto

#2 lore raw
Quoted 8 lines · On Mon, 01 Jun 2020 12:38:32 +0200 Alberto Garcia <[email protected]> wrote:

As I explained a few weeks ago this patch is not correct. quorum_del_child() allows you to remove any child from the Quorum device, so nothing guarantees that next_child_index-1 is free.

https://lists.gnu.org/archive/html/qemu-block/2020-05/msg00634.html

Berto

Hi,
Did you have a look at my series? There it's fixed properly:
https://lore.kernel.org/qemu-devel/9df6b3723ec30cb749ceaa555d82a29a6d79496d.1589199922.git.lukasstraub2@web.de/

Regards,
Lukas Straub

#3 lore raw
Quoted 9 lines · Lukas Straub
Quoted 6 lines

As I explained a few weeks ago this patch is not correct. quorum_del_child() allows you to remove any child from the Quorum device, so nothing guarantees that next_child_index-1 is free.

https://lists.gnu.org/archive/html/qemu-block/2020-05/msg00634.html

Hi,
Did you have a look at my series? There it's fixed properly:
https://lore.kernel.org/qemu-devel/9df6b3723ec30cb749ceaa555d82a29a6d79496d.1589199922.git.lukasstraub2@web.de/

Oh, I somehow overlooked that, thanks for the reminder!

Berto

#4 lore raw
In reply to Lukas Straub

Oh, I missed the patch detail. I just reviewed overall view on your series. Looks your patch is good for me.

Thanks
Zhang Chen

Quoted 30 lines

-----Original Message-----
From: Lukas Straub <[email protected]>
Sent: Tuesday, June 2, 2020 2:12 AM
To: Alberto Garcia <[email protected]>
Cc: Zhang, Chen <[email protected]>; Kevin Wolf <[email protected]>; Max Reitz <[email protected]>; qemu-dev <[email protected]>; Jason Wang <[email protected]>; Zhanghailiang <[email protected]>; Dr . David Alan Gilbert <[email protected]>; Zhang Chen <[email protected]>
Subject: Re: [PATCH] block/quorum.c: Decrease child index when del_child

Quoted 8 lines · On Mon, 01 Jun 2020 12:38:32 +0200 Alberto Garcia <[email protected]> wrote:

As I explained a few weeks ago this patch is not correct. quorum_del_child() allows you to remove any child from the Quorum device, so nothing guarantees that next_child_index-1 is free.

https://lists.gnu.org/archive/html/qemu-block/2020-05/msg00634.html

Berto

Hi,
Did you have a look at my series? There it's fixed properly:
https://lore.kernel.org/qemu-
devel/9df6b3723ec30cb749ceaa555d82a29a6d79496d.1589199922.git.lukasstr [email protected]/

Regards,
Lukas Straub