From nobody Tue May 21 08:26:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1659016922; cv=none; d=zohomail.com; s=zohoarc; b=YnnViSWGNwJzlNkmQVOfmOy4Qy7ldtJBU7CoEsitIEDLcucu5O8iEKDWvXGzzdx1Z2iPq6pyCwgqAPUZ3ylxXkdKi3BlhjNGfcmeqXL73gdobyL6YPqqHlNP/YH9baVvBHlqmGXaPw4tBG8xvFmGhaUI/Y1hmSzBdOr0oYLg3DA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659016922; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=+bwNwObTmy7Q2WcguoVxKocEAKcVu76ws+ZHaaiVd88=; b=CcZ/BW5DDuTFHKMPYQUeRJBYa0BfxRgviIPyeb/FRLBKekKNcmaukXuPiweXmW/omQYS24f6d4toikwZXJ+vLnaV1rFAAWm8ybY7uqkdEV6r8GIcWW/VqKVSAi2LRoluvFKuTFiWemi75mB12pZM2ngTjLPu67ntvAwy+kpm43M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1659016922289859.5077579915154; Thu, 28 Jul 2022 07:02:02 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-662-m4atzkoJMsaikOBBkX0njQ-1; Thu, 28 Jul 2022 10:01:59 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B4F448039A1; Thu, 28 Jul 2022 14:01:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29DF1C28125; Thu, 28 Jul 2022 14:01:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 00DC91945DA7; Thu, 28 Jul 2022 14:01:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 288761945D85 for ; Thu, 28 Jul 2022 14:01:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1C4FC1121319; Thu, 28 Jul 2022 14:01:52 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F21201121314 for ; Thu, 28 Jul 2022 14:01:51 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id E0519240267; Thu, 28 Jul 2022 16:01:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659016921; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+bwNwObTmy7Q2WcguoVxKocEAKcVu76ws+ZHaaiVd88=; b=dFxIx2MLkb9hOIHRlUNsCZWKOIlzBSc5E2F+De+loGbQhOeIgBWOLyxW8oUcvxVQeVPkq3 JCLcKQUGxGsTQQe4fIr5OfE54j79/NBCfpqra4ZJUyBYGhfGVdWhyWxDz0nVn2w8m8WSS7 qoRlrYewks+je6lkxQ2kCeqK4m+whSk= X-MC-Unique: m4atzkoJMsaikOBBkX0njQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH for 8.6.0] qemu_migration_params: Avoid deadlock in qemuMigrationParamsReset Date: Thu, 28 Jul 2022 16:01:40 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659016923338100001 Content-Type: text/plain; charset="utf-8" In my recent comnmit v8.5.0-188-gc47f1abb81 I accidentally moved qemuMigrationParamsResetTLS after qemuDomainObjEnterMonitorAsync not noticing qemuMigrationParamsResetTLS will try to enter the monitor again. The second call will time out and return with a domain object locked. But we're still in monitor section and the object should be unlocked which means qemuDomainObjExitMonitor will deadlock trying to lock it again. Fixes: c47f1abb81194461377a0c608a7ecd87f9ce9146 Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- src/qemu/qemu_migration_params.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_par= ams.c index be7966a18a..9da2fd6d98 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -1291,6 +1291,7 @@ qemuMigrationParamsReset(virQEMUDriver *driver, { virErrorPtr err; g_autoptr(virBitmap) clearCaps =3D NULL; + int rc; =20 virErrorPreserveLast(&err); =20 @@ -1305,11 +1306,16 @@ qemuMigrationParamsReset(virQEMUDriver *driver, =20 clearCaps =3D virBitmapNew(0); =20 - if (qemuMigrationParamsApplyCaps(vm, clearCaps) =3D=3D 0 && - qemuMigrationParamsApplyValues(vm, origParams, false) =3D=3D 0) - qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiF= lags); + rc =3D 0; + if (qemuMigrationParamsApplyCaps(vm, clearCaps) < 0 || + qemuMigrationParamsApplyValues(vm, origParams, false) < 0) + rc =3D -1; =20 qemuDomainObjExitMonitor(vm); + if (rc < 0) + goto cleanup; + + qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags= ); =20 cleanup: virErrorRestore(&err); --=20 2.35.1