qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] When del child, next_child_index need to subtract 1. Otherwise, the index will get bigger and bigger.
@ 2020-05-11 10:00 quweijie
  2020-05-11 10:00 ` [PATCH 2/2] If we have more than one colo-compare, we can only destroy the lock when we delete the last one quweijie
  2020-05-11 10:10 ` [PATCH 1/2] When del child, next_child_index need to subtract 1. Otherwise, the index will get bigger and bigger Alberto Garcia
  0 siblings, 2 replies; 3+ messages in thread
From: quweijie @ 2020-05-11 10:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Max Reitz, Alberto Garcia, open list:Quorum, quweijie

From: quweijie <quweijie@huayun.com>

Signed-off-by: quweijie <quweijie@huayun.com>
---
 block/quorum.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/quorum.c b/block/quorum.c
index 6d7a56b..a8272fe 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -1096,6 +1096,7 @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child,
     memmove(&s->children[i], &s->children[i + 1],
             (s->num_children - i - 1) * sizeof(BdrvChild *));
     s->children = g_renew(BdrvChild *, s->children, --s->num_children);
+    s->next_child_index--;
     bdrv_unref_child(bs, child);
 
     bdrv_drained_end(bs);
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] If we have more than one colo-compare, we can only destroy the lock when we delete the last one.
  2020-05-11 10:00 [PATCH 1/2] When del child, next_child_index need to subtract 1. Otherwise, the index will get bigger and bigger quweijie
@ 2020-05-11 10:00 ` quweijie
  2020-05-11 10:10 ` [PATCH 1/2] When del child, next_child_index need to subtract 1. Otherwise, the index will get bigger and bigger Alberto Garcia
  1 sibling, 0 replies; 3+ messages in thread
From: quweijie @ 2020-05-11 10:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Zhang Chen, Jason Wang, Li Zhijian, quweijie

From: quweijie <quweijie@huayun.com>

Signed-off-by: quweijie <quweijie@huayun.com>
---
 net/colo-compare.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/colo-compare.c b/net/colo-compare.c
index 10c0239..ee878f6 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -1313,8 +1313,10 @@ static void colo_compare_finalize(Object *obj)
         object_unref(OBJECT(s->iothread));
     }
 
-    qemu_mutex_destroy(&event_mtx);
-    qemu_cond_destroy(&event_complete_cond);
+    if(QTAILQ_EMPTY(&net_compares)) {
+        qemu_mutex_destroy(&event_mtx);
+        qemu_cond_destroy(&event_complete_cond);
+    }
 
     g_free(s->pri_indev);
     g_free(s->sec_indev);
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] When del child, next_child_index need to subtract 1. Otherwise, the index will get bigger and bigger.
  2020-05-11 10:00 [PATCH 1/2] When del child, next_child_index need to subtract 1. Otherwise, the index will get bigger and bigger quweijie
  2020-05-11 10:00 ` [PATCH 2/2] If we have more than one colo-compare, we can only destroy the lock when we delete the last one quweijie
@ 2020-05-11 10:10 ` Alberto Garcia
  1 sibling, 0 replies; 3+ messages in thread
From: Alberto Garcia @ 2020-05-11 10:10 UTC (permalink / raw)
  To: quweijie, qemu-devel; +Cc: Kevin Wolf, Max Reitz, open list:Quorum, quweijie

On Mon 11 May 2020 12:00:30 PM CEST, quweijie@huayun.com wrote:
> diff --git a/block/quorum.c b/block/quorum.c
> index 6d7a56b..a8272fe 100644
> --- a/block/quorum.c
> +++ b/block/quorum.c
> @@ -1096,6 +1096,7 @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child,
>      memmove(&s->children[i], &s->children[i + 1],
>              (s->num_children - i - 1) * sizeof(BdrvChild *));
>      s->children = g_renew(BdrvChild *, s->children, --s->num_children);
> +    s->next_child_index--;
>      bdrv_unref_child(bs, child);

This is not correct, quorum_del_child() allows you to remove any child
from the Quorum device, so nothing guarantees you that
next_child_index-1 is free.

Berto


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-11 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-11 10:00 [PATCH 1/2] When del child, next_child_index need to subtract 1. Otherwise, the index will get bigger and bigger quweijie
2020-05-11 10:00 ` [PATCH 2/2] If we have more than one colo-compare, we can only destroy the lock when we delete the last one quweijie
2020-05-11 10:10 ` [PATCH 1/2] When del child, next_child_index need to subtract 1. Otherwise, the index will get bigger and bigger Alberto Garcia

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).