From nobody Sun Apr 28 11:32: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 1536668542706576.2958752845841; Tue, 11 Sep 2018 05:22:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 549A588E48; Tue, 11 Sep 2018 12:22:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E6B7862E9; Tue, 11 Sep 2018 12:22:21 +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 A090A4A460; Tue, 11 Sep 2018 12:22:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w8B8B6ku002739 for ; Tue, 11 Sep 2018 04:11:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id D8A783091385; Tue, 11 Sep 2018 08:11:06 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2BDE3091373 for ; Tue, 11 Sep 2018 08:11:03 +0000 (UTC) Received: from mxct.zte.com.cn (out1.zte.com.cn [202.103.147.172]) (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 1AE99C057F4E for ; Tue, 11 Sep 2018 08:11:01 +0000 (UTC) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id A04FF30511E4598087E5 for ; Tue, 11 Sep 2018 16:10:58 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id w8B8AjLC066973 for ; Tue, 11 Sep 2018 16:10:45 +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 2018091116104687-8366033 ; Tue, 11 Sep 2018 16:10:46 +0800 From: Wang Yechao To: libvir-list@redhat.com Date: Tue, 11 Sep 2018 16:15:24 +0800 Message-Id: <1536653724-19228-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-11 16:10:46, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-09-11 16:10:41, Serialize complete at 2018-09-11 16:10:41 X-MAIL: mse01.zte.com.cn w8B8AjLC066973 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.32]); Tue, 11 Sep 2018 08:11:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 11 Sep 2018 08:11:01 +0000 (UTC) for IP:'202.103.147.172' DOMAIN:'out1.zte.com.cn' HELO:'mxct.zte.com.cn' FROM:'wang.yechao255@zte.com.cn' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 202.103.147.172 out1.zte.com.cn 202.103.147.172 out1.zte.com.cn X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Tue, 11 Sep 2018 08:21:41 -0400 Cc: Wang Yechao Subject: [libvirt] [PATCH] 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 11 Sep 2018 12:22:22 +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