From nobody Tue Mar 3 03:24:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1772015280; cv=none; d=zohomail.com; s=zohoarc; b=A1y+3MlaTKG64VQsT8GYqX3TCBCHf4ZkwTLQgjyhzdsEk+B+j02s07XWwiFKFabQYbpQS6ERT1BnSsBd2pQAfIk9aap3xvQu7REfnTcRYWxDEOevuXac/ruA+a9Jd3g/NVV+lR6udS4/QGyKvcClyLcVG0pUMQ0copO7/VStCbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772015280; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=i1lyLNqNKi9LOSiImD9YsTAxpVOMuEmv5RG5YrGo9bg=; b=gwEGDvknd+6Y3whpOexFgeczyRL9HuRV+5k7798e+FXMqA7UO4e171XHb7O4g5+U/tbKgw8IQBVeF3w836rkU4wOE1IJ0rJkH1d1rXtQ5z6wQ7VCeg5/ewSnWWq4BxQXqyklMtyGAbvgOwplMgIgjyVZjia6wiGcriiG5Lj+ve4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1772015280463547.3769715813063; Wed, 25 Feb 2026 02:28:00 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 495CA41D5B; Wed, 25 Feb 2026 05:27:59 -0500 (EST) Received: from [172.19.199.9] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 7E91F41DFD; Wed, 25 Feb 2026 05:27:26 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id B990141D3B; Wed, 25 Feb 2026 05:27:20 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id EF1C441B64 for ; Wed, 25 Feb 2026 05:27:19 -0500 (EST) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-399-Z29LRGuxPKmZlfnTiHRaTQ-1; Wed, 25 Feb 2026 05:27:17 -0500 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 100C519560A7 for ; Wed, 25 Feb 2026 10:27:17 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A04C73003D88 for ; Wed, 25 Feb 2026 10:27:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772015239; h=from:from: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; bh=i1lyLNqNKi9LOSiImD9YsTAxpVOMuEmv5RG5YrGo9bg=; b=BU0TSa7hNbhJBnk6tQrH1bKfZJ/cp8fqDD5yAZ4gKSZvDG/XzGE1NMrnylemhAOSFszwDl HRdeXlh0t+nSP8Is3MUmywskw5b+uyLn8CjhGN3Sr2rDRQ9GNsFhHqY2M6WzPFfdP1SYL1 33iUQ11yaP55Nf2Us12W6mOBzmJhBPs= X-MC-Unique: Z29LRGuxPKmZlfnTiHRaTQ-1 X-Mimecast-MFC-AGG-ID: Z29LRGuxPKmZlfnTiHRaTQ_1772015237 To: devel@lists.libvirt.org Subject: [PATCH] qemu: Fix job handling when domain dies in post-copy migration Date: Wed, 25 Feb 2026 11:27:14 +0100 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: eudoFd1eee6HmYesrKB24y192FdDJyUxZ3eMTix6z_w_1772015237 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZWUGGAZIZHCDVFVJ3QE7H5NVAGGZE4BF X-Message-ID-Hash: ZWUGGAZIZHCDVFVJ3QE7H5NVAGGZE4BF X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jiri Denemark via Devel Reply-To: Jiri Denemark X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1772015281657158500 Content-Type: text/plain; charset="utf-8" From: Jiri Denemark When a domain is in post-copy migration phase, we need to keep the job active if something fails to protect the domain from changes. Unfortunately, there is a race between migration code and qemuProcessStop that can cause the job to stay active even when the domain is gone and thus preventing the domain from being started again (until virtqemud is restarted). The race is caused by unlocking the vm object when calling virConnectUnregisterCloseCallback. While the domain is unlocked qemuProcessStop can finish its work and the domain may no longer be active when we get the lock back. The post-copy path does not properly check if a domain is still active. Instead of adding the virDomainObjIsActive check in all places where this could happen, we can add it in virDomainObjIsPostcopy and virDomainObjIsFailedPostcopy and let the code take the pre-copy cleanup path. Clearly an inactive domain can never be in (failed) post-copy migration. https://issues.redhat.com/browse/RHEL-145179 Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 998b333c74..3528b90742 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -30723,6 +30723,9 @@ bool virDomainObjIsFailedPostcopy(virDomainObj *dom, virDomainJobObj *job) { + if (!virDomainObjIsActive(dom)) + return false; + if (job && job->asyncPaused && (job->asyncJob =3D=3D VIR_ASYNC_JOB_MIGRATION_IN || job->asyncJob =3D=3D VIR_ASYNC_JOB_MIGRATION_OUT)) @@ -30739,6 +30742,9 @@ bool virDomainObjIsPostcopy(virDomainObj *dom, virDomainJobObj *job) { + if (!virDomainObjIsActive(dom)) + return false; + if (virDomainObjIsFailedPostcopy(dom, job)) return true; =20 --=20 2.53.0