diff mbox series

block/quorum.c: Decrease child index when del_child

Message ID 20200601071956.18006-1-chen.zhang@intel.com
State New
Headers show
Series block/quorum.c: Decrease child index when del_child | expand

Commit Message

Zhang, Chen June 1, 2020, 7:19 a.m. UTC
From: Zhang Chen <chen.zhang@intel.com>

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.

Reported-by: Ye.Zou <ye.zou@zstack.io>
Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
 block/quorum.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Alberto Garcia June 1, 2020, 10:38 a.m. UTC | #1
On Mon 01 Jun 2020 09:19:56 AM CEST, Zhang Chen wrote:
> From: Zhang Chen <chen.zhang@intel.com>
>
> 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.
>
> Reported-by: Ye.Zou <ye.zou@zstack.io>
> Signed-off-by: Zhang Chen <chen.zhang@intel.com>
> ---
>  block/quorum.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/block/quorum.c b/block/quorum.c
> index 7cf7ab1546..f71bd4e19d 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -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
Lukas Straub June 1, 2020, 6:12 p.m. UTC | #2
On Mon, 01 Jun 2020 12:38:32 +0200
Alberto Garcia <berto@igalia.com> 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
Alberto Garcia June 1, 2020, 9:41 p.m. UTC | #3
On Mon 01 Jun 2020 08:12:00 PM CEST, Lukas Straub 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
>> 
> 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
Zhang, Chen June 2, 2020, 12:59 a.m. UTC | #4
Oh, I missed the patch detail. I just reviewed overall view on your series.
Looks your patch is good for me.

Thanks
Zhang Chen

> -----Original Message-----
> From: Lukas Straub <lukasstraub2@web.de>
> Sent: Tuesday, June 2, 2020 2:12 AM
> To: Alberto Garcia <berto@igalia.com>
> Cc: Zhang, Chen <chen.zhang@intel.com>; Kevin Wolf <kwolf@redhat.com>;
> Max Reitz <mreitz@redhat.com>; qemu-dev <qemu-devel@nongnu.org>;
> Jason Wang <jasowang@redhat.com>; Zhanghailiang
> <zhang.zhanghailiang@huawei.com>; Dr . David Alan Gilbert
> <dgilbert@redhat.com>; Zhang Chen <zhangckid@gmail.com>
> Subject: Re: [PATCH] block/quorum.c: Decrease child index when del_child
> 
> On Mon, 01 Jun 2020 12:38:32 +0200
> Alberto Garcia <berto@igalia.com> 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
> aub2@web.de/
> 
> Regards,
> Lukas Straub
diff mbox series

Patch

diff --git a/block/quorum.c b/block/quorum.c
index 7cf7ab1546..f71bd4e19d 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -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);
 }