From nobody Wed May 1 09:54:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1536837829958380.5626409841926; Thu, 13 Sep 2018 04:23:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F94B5F732; Thu, 13 Sep 2018 11:23:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6118B10694CA; Thu, 13 Sep 2018 11:23:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 145F318005DF; Thu, 13 Sep 2018 11:23:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8DBNiFq021049 for ; Thu, 13 Sep 2018 07:23:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 832DD4531; Thu, 13 Sep 2018 11:23:44 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76DCC19480 for ; Thu, 13 Sep 2018 11:23:41 +0000 (UTC) Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.217.80.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E94C3001A49 for ; Thu, 13 Sep 2018 11:23:40 +0000 (UTC) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 8F232D80E9559238EDFF for ; Thu, 13 Sep 2018 19:23:38 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id w8DBNV9m050522 for ; Thu, 13 Sep 2018 19:23:31 +0800 (GMT-8) (envelope-from wang.yechao255@zte.com.cn) Received: from kvm-146.zte.com.cn ([10.74.120.146]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018091319235087-8824422 ; Thu, 13 Sep 2018 19:23:50 +0800 From: Wang Yechao To: libvir-list@redhat.com Date: Thu, 13 Sep 2018 19:28:12 +0800 Message-Id: <1536838092-30145-1-git-send-email-wang.yechao255@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2018-09-13 19:23:50, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-09-13 19:23:20, Serialize complete at 2018-09-13 19:23:20 X-MAIL: mse01.zte.com.cn w8DBNV9m050522 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 212 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 13 Sep 2018 11:23:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 13 Sep 2018 11:23:40 +0000 (UTC) for IP:'63.217.80.70' DOMAIN:'mxhk.zte.com.cn' HELO:'mxhk.zte.com.cn' FROM:'wang.yechao255@zte.com.cn' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 63.217.80.70 mxhk.zte.com.cn 63.217.80.70 mxhk.zte.com.cn X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Wang Yechao Subject: [libvirt] [PATCH v2] qemu: fix deadlock if create qemuProcessReconnect thread failed X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 13 Sep 2018 11:23:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" qemuProcessReconnectHelper has hold the doms lock, if create qemuProcessReconnect thread failed, it will get the doms lock again to remove the dom from doms list. add obj->inReconnetCtx flag to avoid deadlock. Signed-off-by: Wang Yechao --- src/conf/domain_conf.h | 1 + src/conf/virdomainobjlist.c | 6 ++++-- src/qemu/qemu_process.c | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e30a4b2..5bc5771 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2608,6 +2608,7 @@ struct _virDomainObj { virDomainSnapshotObjPtr current_snapshot; =20 bool hasManagedSave; + bool inReconnectCtx; =20 void *privateData; void (*privateDataFreeFunc)(void *); diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index 805fe94..30300b4 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -397,11 +397,13 @@ virDomainObjListRemove(virDomainObjListPtr doms, dom->removing =3D true; virObjectRef(dom); virObjectUnlock(dom); - virObjectRWLockWrite(doms); + if (!dom->inReconnectCtx) + virObjectRWLockWrite(doms); virObjectLock(dom); virDomainObjListRemoveLocked(doms, dom); virObjectUnref(dom); - virObjectRWUnlock(doms); + if (!dom->inReconnectCtx) + virObjectRWUnlock(doms); } =20 =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index eb9904b..8c30850 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8029,6 +8029,7 @@ qemuProcessReconnectHelper(virDomainObjPtr obj, */ qemuProcessStop(src->driver, obj, VIR_DOMAIN_SHUTOFF_FAILED, QEMU_ASYNC_JOB_NONE, 0); + obj->inReconnectCtx =3D true; qemuDomainRemoveInactiveJob(src->driver, obj); =20 virDomainObjEndAPI(&obj); --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list