From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id D01611FF2B0 for ; Fri, 5 Jul 2024 11:37:57 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AA8C33F38A; Fri, 5 Jul 2024 11:38:15 +0200 (CEST) MIME-Version: 1.0 In-Reply-To: <20240610125942.116985-8-f.ebner@proxmox.com> References: <20240610125942.116985-1-f.ebner@proxmox.com> <20240610125942.116985-8-f.ebner@proxmox.com> From: Fabian =?utf-8?q?Gr=C3=BCnbichler?= To: Proxmox VE development discussion Date: Fri, 05 Jul 2024 11:37:36 +0200 Message-ID: <172017225653.125161.6236276570194083834@yuna.proxmox.com> User-Agent: alot/0.10 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.050 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: Re: [pve-devel] [RFC qemu 7/7] block/backup: set callback for cbw errors X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Quoting Fiona Ebner (2024-06-10 14:59:42) > The callback is invoked when cbw is configured to not break the guest > write and will abort a backup job immediately. Currently the backup > has to wait for the rest of the block copy operation to finish before > checking the cbw error state. > > Signed-off-by: Fiona Ebner > --- > > Note for testers: if e.g. the PBS is compeletly unreachable, the > backup job still will need to wait until the in-flight request is > aborted after 15 minutes. But the guest writes should be fast again. could we improve that by checking the status in the pbs-qemu lib periodically, and aborting there as well? how is the bitmap handled in case of a cbw-timeout/error? > > block/backup.c | 41 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/block/backup.c b/block/backup.c > index ba153110d3..43d34ce4c2 100644 > --- a/block/backup.c > +++ b/block/backup.c > @@ -32,6 +32,45 @@ > > static const BlockJobDriver backup_job_driver; > > +typedef struct { > + Job *job; > + int ret; > +} BackupOnCbwError; > + > +static void backup_on_cbw_error_cb_bh(void *opaque) > +{ > + BackupOnCbwError *data = opaque; > + if (data->job) { > + WITH_JOB_LOCK_GUARD() { > + if (!job_is_completed_locked(data->job)) { > + error_report("backup was cancelled because of copy-before-write error: %s", > + strerror(-data->ret)); > + job_cancel_locked(data->job, true); > + } > + } > + } else { > + error_report("backup_on_cbw_error_cb_bh: no job! Error: %s", strerror(-data->ret)); > + } > + > + g_free(data); > +} > + > +static void backup_on_cbw_error_cb(void *opaque, int ret) > +{ > + BackupOnCbwError *data = g_new0(BackupOnCbwError, 1); > + data->job = opaque; > + data->ret = ret; > + > + /* > + * backup_cancel() cannot run in coroutine context. > + */ > + if (qemu_in_coroutine()) { > + aio_bh_schedule_oneshot(qemu_get_aio_context(), backup_on_cbw_error_cb_bh, data); > + } else { > + backup_on_cbw_error_cb_bh(data); > + } > +} > + > static void backup_cleanup_sync_bitmap(BackupBlockJob *job, int ret) > { > BdrvDirtyBitmap *bm; > @@ -477,6 +516,8 @@ BlockJob *backup_job_create(const char *job_id, BlockDriverState *bs, > goto error; > } > > + bdrv_cbw_set_error_cb(cbw, backup_on_cbw_error_cb, job); > + > job->cbw = cbw; > job->source_bs = bs; > job->target_bs = target; > -- > 2.39.2 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel