From nobody Mon Feb 9 01:31:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1615477853; cv=none; d=zohomail.com; s=zohoarc; b=lcyxyzSImbvyFbmX04nC12EPQzBKCvcNHbfq+TKEzL5iAVABIb3DPERP0QiwZ72felTrcvrVttKODa2yie82oqNBwnED7zVLTyZzDszDYgnAN0NVPdo5xv7BxTwG2O8lSeNc9r5sEs7ystqugJ6bW9GWbKD2FBBKT/R8eMVu1tk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615477853; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GA59NcgsvfM+JN3KjeeOy4zuy7/SYlYRgUS5W5AfriY=; b=j4m9V9QnWQ3ogfywK4T8JtiqX7K5gpjrf/HR5jS3bwBGpDKSIcOwej7CtfPOpt/4S9++BTR5h4y1sTJ/2BXaSTRQnDBUJoav2iYolZihdX1vKoh0wnZOGlG0xnY71cwJAZrHDK7BRxTlFUwBEcYQnxnua5cKHZBKjZ+jJrtOvz8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1615477853911749.2021836202217; Thu, 11 Mar 2021 07:50:53 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-3TvC7LMNN2C4YbwrtiZ5mg-1; Thu, 11 Mar 2021 10:50:50 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 072EA83DD21; Thu, 11 Mar 2021 15:50:45 +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 98CC519C78; Thu, 11 Mar 2021 15:50:44 +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 C73441800232; Thu, 11 Mar 2021 15:50:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12BFofx4014429 for ; Thu, 11 Mar 2021 10:50:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1D91E5C23E; Thu, 11 Mar 2021 15:50:41 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E8615C1CF for ; Thu, 11 Mar 2021 15:50:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615477852; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=GA59NcgsvfM+JN3KjeeOy4zuy7/SYlYRgUS5W5AfriY=; b=K94PN5LpNSrJ3YVhZw9qQPnH1wF5ClX5u3GdWyVSWC6XAD5EC+MzpnHidoKzfElwIk23A0 Y8qu1ZP5hbAGo6eK3iSba3yDP5jUsSkff0Y3ROS7JSopLHZvZSv+m25WSGTCJGyoQevmd1 KP0qcNPXj/FHmLC8RjHqRCsB4kD99Z4= X-MC-Unique: 3TvC7LMNN2C4YbwrtiZ5mg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] qemuBackupJobTerminate: Fix job termination for inactive VMs Date: Thu, 11 Mar 2021 16:50:37 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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) Content-Type: text/plain; charset="utf-8" Commit cb29e4e801d didn't take into account that the VM can be inactive when it's destroyed. This means that the job would remain active also when the VM became inactive. To fix this properly: 1) Remove the bogus VM liveness check and early return (reverts the aforementioned commit) 2) Conditionalize the stats assignment only when the stats object is present (properly fix the crash when VM dies when reconnecting) 3) end the asyncjob only when it was already set (prevent corruption of priv->jobs_queued) Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1937598 Fixes: cb29e4e801d Signed-off-by: Peter Krempa --- I didn't come up with a reasonable split so that I'd avoid the 'technically' 3 changes in one patch so that it'd still make sense. src/qemu/qemu_backup.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index f6096f643f..f91d632715 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -583,27 +583,28 @@ qemuBackupJobTerminate(virDomainObjPtr vm, } } - if (!virDomainObjIsActive(vm)) - return; - - qemuDomainJobInfoUpdateTime(priv->job.current); + if (priv->job.current) { + qemuDomainJobInfoUpdateTime(priv->job.current); - g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree); - priv->job.completed =3D qemuDomainJobInfoCopy(priv->job.current); + g_clear_pointer(&priv->job.completed, qemuDomainJobInfoFree); + priv->job.completed =3D qemuDomainJobInfoCopy(priv->job.current); - priv->job.completed->stats.backup.total =3D priv->backup->push_total; - priv->job.completed->stats.backup.transferred =3D priv->backup->push_t= ransferred; - priv->job.completed->stats.backup.tmp_used =3D priv->backup->pull_tmp_= used; - priv->job.completed->stats.backup.tmp_total =3D priv->backup->pull_tmp= _total; + priv->job.completed->stats.backup.total =3D priv->backup->push_tot= al; + priv->job.completed->stats.backup.transferred =3D priv->backup->pu= sh_transferred; + priv->job.completed->stats.backup.tmp_used =3D priv->backup->pull_= tmp_used; + priv->job.completed->stats.backup.tmp_total =3D priv->backup->pull= _tmp_total; - priv->job.completed->status =3D jobstatus; - priv->job.completed->errmsg =3D g_strdup(priv->backup->errmsg); + priv->job.completed->status =3D jobstatus; + priv->job.completed->errmsg =3D g_strdup(priv->backup->errmsg); - qemuDomainEventEmitJobCompleted(priv->driver, vm); + qemuDomainEventEmitJobCompleted(priv->driver, vm); + } virDomainBackupDefFree(priv->backup); priv->backup =3D NULL; - qemuDomainObjEndAsyncJob(priv->driver, vm); + + if (priv->job.asyncJob =3D=3D QEMU_ASYNC_JOB_BACKUP) + qemuDomainObjEndAsyncJob(priv->driver, vm); } --=20 2.29.2