From nobody Fri Oct 18 08:47:03 2024 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=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1718291555861624.2784250052547; Thu, 13 Jun 2024 08:12:35 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CCCC2E1F; Thu, 13 Jun 2024 11:12:34 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 558A011E7; Thu, 13 Jun 2024 11:11:55 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 2CD41A79; Thu, 13 Jun 2024 11:11:51 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B27F1A64 for ; Thu, 13 Jun 2024 11:11:50 -0400 (EDT) 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-449-O9_i2QtwODugMBt2sfyj4Q-1; Thu, 13 Jun 2024 11:11:49 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 0DFE819560AD for ; Thu, 13 Jun 2024 15:11:48 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.20]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 2E6E1195605E for ; Thu, 13 Jun 2024 15:11:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: *** X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718291510; 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: in-reply-to:in-reply-to:references:references; bh=tJ47AAuHsbuXNBRcWbc8ulD+biSDFiqTy5c87d/TNWQ=; b=iY/4bODTuqpRL5DZoEF9ZGgLxtFnhe/h7ytDv5FZwzpRUFigJr/Cqqt5nTxFlX2a3rr/7e L6dGfwt4ecaLqrC5p+E9QvEIK8q3INwFXS7p2y1FCmu7Vi4nhy1xs3kZufE7sGbq6M88xn rNGYZOtJmH7lsPm18o4kGopo1cOsY/c= X-MC-Unique: O9_i2QtwODugMBt2sfyj4Q-1 From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 01/12] qemuBlockJobProcessEventConcludedBackup: Handle potentially NULL 'job->disk' Date: Thu, 13 Jun 2024 17:11:33 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 3IMWBJX4B3SLVVS7MWZ57SZRSBN6DP33 X-Message-ID-Hash: 3IMWBJX4B3SLVVS7MWZ57SZRSBN6DP33 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1718291557461100001 Content-Type: text/plain; charset="utf-8" Similarly to other blockjob handlers, if there's no disk associated with the blockjob the handler needs to behave correctly. This is needed as the disk might have been de-associated on unplug or other operations. Signed-off-by: Peter Krempa --- src/qemu/qemu_backup.c | 6 +++--- src/qemu/qemu_backup.h | 2 +- src/qemu/qemu_blockjob.c | 9 +++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index 857709b17e..81391c29f7 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -966,7 +966,7 @@ qemuBackupGetXMLDesc(virDomainObj *vm, void qemuBackupNotifyBlockjobEnd(virDomainObj *vm, - virDomainDiskDef *disk, + const char *diskdst, qemuBlockjobState state, const char *errmsg, unsigned long long cur, @@ -983,7 +983,7 @@ qemuBackupNotifyBlockjobEnd(virDomainObj *vm, size_t i; VIR_DEBUG("vm: '%s', disk:'%s', state:'%d' errmsg:'%s'", - vm->def->name, disk->dst, state, NULLSTR(errmsg)); + vm->def->name, NULLSTR(diskdst), state, NULLSTR(errmsg)); if (!backup) return; @@ -1016,7 +1016,7 @@ qemuBackupNotifyBlockjobEnd(virDomainObj *vm, if (!backupdisk->store) continue; - if (STREQ(disk->dst, backupdisk->name)) { + if (STREQ_NULLABLE(diskdst, backupdisk->name)) { switch (state) { case QEMU_BLOCKJOB_STATE_COMPLETED: backupdisk->state =3D VIR_DOMAIN_BACKUP_DISK_STATE_COMPLET= E; diff --git a/src/qemu/qemu_backup.h b/src/qemu/qemu_backup.h index ec0603026a..768da6cbef 100644 --- a/src/qemu/qemu_backup.h +++ b/src/qemu/qemu_backup.h @@ -36,7 +36,7 @@ qemuBackupJobCancelBlockjobs(virDomainObj *vm, void qemuBackupNotifyBlockjobEnd(virDomainObj *vm, - virDomainDiskDef *disk, + const char *diskdst, qemuBlockjobState state, const char *errmsg, unsigned long long cur, diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 4b5b63d287..42856df6d4 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1372,8 +1372,12 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDrive= r *driver, unsigned long long progressTotal) { g_autoptr(qemuBlockStorageSourceAttachData) backend =3D NULL; + const char *diskdst =3D NULL; + + if (job->disk) + diskdst =3D job->disk->dst; - qemuBackupNotifyBlockjobEnd(vm, job->disk, newstate, job->errmsg, + qemuBackupNotifyBlockjobEnd(vm, diskdst, newstate, job->errmsg, progressCurrent, progressTotal, asyncJob); if (job->data.backup.store && @@ -1386,7 +1390,8 @@ qemuBlockJobProcessEventConcludedBackup(virQEMUDriver= *driver, if (backend) qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), bac= kend); - if (job->data.backup.bitmap) + if (job->disk && + job->data.backup.bitmap) qemuMonitorBitmapRemove(qemuDomainGetMonitor(vm), qemuBlockStorageSourceGetEffectiveNodename= (job->disk->src), job->data.backup.bitmap); --=20 2.45.2