qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: quweijie@huayun.com
To: qemu-devel@nongnu.org
Cc: Zhang Chen <chen.zhang@intel.com>,
	Jason Wang <jasowang@redhat.com>,
	Li Zhijian <lizhijian@cn.fujitsu.com>,
	quweijie <quweijie@huayun.com>
Subject: [PATCH 2/2] If we have more than one colo-compare, we can only destroy the lock when we delete the last one.
Date: Mon, 11 May 2020 18:00:31 +0800	[thread overview]
Message-ID: <1589191231-18876-2-git-send-email-quweijie@huayun.com> (raw)
In-Reply-To: <1589191231-18876-1-git-send-email-quweijie@huayun.com>

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



  reply	other threads:[~2020-05-11 14:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-05-11 10:10 ` Alberto Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1589191231-18876-2-git-send-email-quweijie@huayun.com \
    --to=quweijie@huayun.com \
    --cc=chen.zhang@intel.com \
    --cc=jasowang@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).