From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.openvz.org (mail.openvz.org [69.168.225.77]) by lore.virtuozzo.com (Postfix) with ESMTPS id D3A9B803BB for ; Tue, 17 Nov 2026 10:45:31 +0000 (UTC) Received: from mail.openvz.org (localhost [127.0.0.1]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AHAiL2C008407; Tue, 17 Nov 2026 13:44:21 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHAiL2C008407 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="F8ao6XyM" Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AHAhXSe008322 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 17 Nov 2026 13:43:34 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHAhXSe008322 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-4923b9fdd43so3344600f8f.3 for ; Tue, 17 Nov 2026 02:43:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEYplhcR54t7y1Ms8W7aWAHTEWZttruIO/AriLd8yMJyBYgRgEfzuorVb2YODxLqAHOaOnoaQ==@openvz.org X-Gm-Message-State: APuU4Z/rVqOymLbLE+uXTp6lwSZRMfOL/UpGfjEtnWrvBilDrCtp4BX5 O2DgxmXEs4831QImRVkl8DrulQoTvk1N3zXEfPmbETWLU4X0raKvLaRefp+CmW0rO+Inm2PwICH GsXtzv2e87gXFT/9iGDa93OGvMM+vFegHdysE0xKLEm8o8tERJTQgGA== X-Gm-Gg: AYBFou3irbOZm65gfEQVgGs+ZPje2AGCF8SvJdFJL3hFR/XMxtuQfgHToyzTUp1DZmR rCXmhy1oCOhk3AbH8IWAwY4YK69rQSpATbV11HQqpKxvPjJBR31MSEUGUJYSH25Th+XKlO3dFeQ l9wlvA39hEh4kfLsjxBS7/0yCRJfQxaQOI8nwVE/HYj5RcWRAKgPy2+TzfWSn7tiP6JS4vjsjcX cxaAnZjS89DVss8gmwUb6hskmK9Rz7ZBppFChx1E3K+Zq+UKh1Td46Vmtmf4YOh7O4lJx2/HJqp MFu2ZBRDNqUno9HAw0ZawymdmVK78c5+YzQb5j+Zo4E5HztK6O6ueQjRsz95tKdnkp8zDbJWpEJ 0sYtwuraMD4N9y9TNAZYg38lqoE4I X-Received: by 2002:a05:600c:1d0e:b0:49f:e772:6ddf with SMTP id 5b1f17b1804b1-4bb55a7f5f3mr286135875e9.32.1794912213573; Tue, 17 Nov 2026 02:43:33 -0800 (PST) X-Received: by 2002:a05:600c:1d0e:b0:49f:e772:6ddf with SMTP id 5b1f17b1804b1-4bb55a7f5f3mr286135235e9.32.1794912212986; Tue, 17 Nov 2026 02:43:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794912212; cv=none; d=google.com; s=arc-20260327; b=B2gnMddDxnASN95XF1TpZDp2+o+xgrgMgA4uTBEpTs+zRsPPoCuiPswIQT5mUA4fiH 4ZGNpR5BqQYOHyyPqemCjPbmHv3l3MEM71482zh820fd+EVqLIh9XQI23zbPCwZk8NRl IPt77Skiwd0nQWCGOPR52x4srrWHMElYFKKMHJEtSMW5OWAvUjJd1xzdpqPy+88JA11X Vyuysw9nWKtFO59GVRT/vWe/MUTdSDAticcHgL7oxCF6Nt0iswWcnjxs1FoVJdbHCpuc ibm53YQOF6gX4dbXkeOOf8CP3nzeB43k2klrnlJKK54Qc1bdcVYBGKN5u/IJtEFO8vc1 uTvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=rHmu2vB71/z2U2sU3xHVOUlhv33IPw/DnVtCBDVk4bI=; fh=CMILZ+goaghq6B4UpCDhf0EQp6kYD0LAlmOkUiVCOvs=; b=K7fJWY7UVUJ/jwNG5b+/Bg5VSX/c+xMxuqeTXt8fw064/lLvyLNE/zuENhWrG/Cgy5 htbHgqgB5nrnRbwyboOX2G6koR8rGz6FxRITtJPMlROGy3HbgFin5fS8qV5Eu6RyVvct Li7rz3x4yzs+tWVdOfER8mXm3+C5hoFfTvOedpTf7TEwgatIwYTH80Mjs4kI08owYR6w XgH7VbKmkNxelOYj+BdR4ytLxKmzZ4r07lPR0+bdZCHUHx0fbv6ivH4Iajp2He8gOTfy QkG/er7AvO5tOp7DaOxxJpF9zRtcadWOasUTZ2JZChcX0qP4BOZtolFZihZnQuGWyDGJ ohJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=F8ao6XyM; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: from relay.virtuozzo.com (relay.virtuozzo.com. [130.117.225.111]) by mx.google.com with ESMTPS id 5b1f17b1804b1-4bb78437417si46200155e9.10.2026.11.17.02.43.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2026 02:43:32 -0800 (PST) Received-SPF: pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) client-ip=130.117.225.111; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=F8ao6XyM; spf=pass (google.com: domain of alexander.ivanov@virtuozzo.com designates 130.117.225.111 as permitted sender) smtp.mailfrom=alexander.ivanov@virtuozzo.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=rHmu2vB71/z2U2sU3xHVOUlhv33IPw/DnVtCBDVk4bI=; b=F8ao6XyM/gGu smdA2UuX3xN06gcA+FWEZRgkFEzR1DZBZkVIiyUsI8aE3kafrZi0QtoA6eIMClIHY80Cfoj02sTSu 1sw74QhFSuSp+Pz+4dZpyqJsuzjdEXU8e8WXKaCxGrXM3vXpPy5o5Fyge6A2T0x3AWIaVl9oCm6X2 Chh4Si1Rll8cKWtyNEqrFyE0Km3B3Xtnx+Xim3/424FOLA1HwdQ2kmqdsbpfpqmRGY5KMvcczWUkM WPM0Tp+RRCUcjPc4ENUIZVXTSRTNFB2VEbc/qLeEYdiUPjmpoy2fb4onLIwSI8ZM+SgpDucz4c84f WgdX4xKmCanOm05ONvPi2w==; Received: from ch-vpn.virtuozzo.com ([130.117.225.6] helo=sky) by relay.virtuozzo.com with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xTGai-009vj8-1A; Tue, 17 Nov 2026 11:43:23 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Tue, 17 Nov 2026 11:43:28 +0100 Message-ID: <20261117104329.3079812-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261117104329.3079812-1-alexander.ivanov@virtuozzo.com> References: <20261117104329.3079812-1-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v3 8/9] drivers/md/dm-qcow2: requeue held requests on a noflush suspend X-BeenThere: devel@openvz.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: OpenVZ development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: devel-bounces@openvz.org Errors-To: devel-bounces@openvz.org A request failed under the enospc or stop policy cannot stay held across a suspend: the suspend waits for it to complete. So presuspend retries the held requests once, and a request that fails again is completed with its error. A table reload or a snapshot taken while the VM is paused on a held request then delivers the error that the policy was meant to keep from the guest. On a noflush suspend, requeue such a request to the dm queue instead. It is dispatched through the new table on resume and is held again if the error persists. This follows dm-mpath, which requeues on a noflush suspend and fails the I/O queued for no paths on a flush suspend. ploop suspends with flags 0, a flush suspend, for a snapshot and a resize in ploop_suspend_device(), so it gets the requeue only with the ploop.ovz change "lib: suspend unpartitioned dm-qcow2 devices with noflush". A partitioned device keeps the flush suspend there and still completes a held request with its error. The noflush mode is recorded in presuspend rather than read with dm_noflush_suspending(): an interrupted suspend clears DMF_NOFLUSH_SUSPENDING and restarts the queue before presuspend_undo runs, and a request failing in between would get its error although the suspend was cancelled. The request is requeued with a delay, as dm-mpath does for the no-path case: until the queue is stopped, or after an interrupted suspend restarts it, a request that keeps failing would otherwise be dispatched and requeued in a loop. dm_requeue_original_rq() gets a delay argument for that. Requeued requests keep the device open: their submitter cannot drop its last reference until they complete, so a remove fails with EBUSY until the device is resumed with a working table or with an error table, as dmsetup remove --force does. dm-mpath with queue_if_no_path behaves the same way. fail_held fails with EBUSY during a noflush suspend: the requeued requests are out of the target's reach, and the flag would not survive a table reload. Userspace sends it again after resume. https://virtuozzo.atlassian.net/browse/VSTOR-152175 Feature: dm-qcow2: block device over QCOW2 files driver Signed-off-by: Alexander Ivanov --- drivers/md/dm-push-backup.c | 2 +- drivers/md/dm-qcow2-cmd.c | 6 +++--- drivers/md/dm-qcow2-map.c | 22 +++++++++++++++++++--- drivers/md/dm-qcow2-target.c | 2 ++ drivers/md/dm-qcow2.h | 3 ++- drivers/md/dm-rq.c | 4 ++-- drivers/md/dm-rq.h | 2 +- 7 files changed, 30 insertions(+), 11 deletions(-) diff --git a/drivers/md/dm-push-backup.c b/drivers/md/dm-push-backup.c index 4f6dc1f3c130..ca1f623f56a7 100644 --- a/drivers/md/dm-push-backup.c +++ b/drivers/md/dm-push-backup.c @@ -218,7 +218,7 @@ static void resubmit_pbios(struct push_backup *pb, struct list_head *list) list_del_init(&pbio->list); mempool_free(pbio, pb->pbio_pool); - dm_requeue_original_rq(rq); + dm_requeue_original_rq(rq, false); } } diff --git a/drivers/md/dm-qcow2-cmd.c b/drivers/md/dm-qcow2-cmd.c index 6a56919bec73..9106ce65d355 100644 --- a/drivers/md/dm-qcow2-cmd.c +++ b/drivers/md/dm-qcow2-cmd.c @@ -660,9 +660,9 @@ int qcow2_message(struct dm_target *ti, unsigned int argc, char **argv, ret = -EINVAL; goto out; } - timer_delete(&tgt->held_timer); - qcow2_fail_held_qios(tgt); - ret = 0; + ret = qcow2_fail_held_qios(tgt); + if (!ret) + timer_delete(&tgt->held_timer); goto out; } else if (!strcmp(argv[0], "merge_backward")) { if (argc < 2) { diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index adbebe728f99..830e3af28730 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -4570,7 +4570,8 @@ static bool qcow2_try_hold_error(struct qcow2_target *tgt, struct qcow2_rq *qrq, struct qio *qio, blk_status_t bi_status) { bool write = op_is_write(qio->bi_op) || qio->bi_op == REQ_OP_FLUSH; - bool held = true, first = false; + bool held = true, first = false, requeue = false; + struct request *rq = qrq->rq; unsigned long flags; u8 policy; @@ -4584,7 +4585,10 @@ static bool qcow2_try_hold_error(struct qcow2_target *tgt, struct qcow2_rq *qrq, spin_lock_irqsave(&tgt->event_lock, flags); if (unlikely(tgt->wants_suspend || tgt->fail_held)) { - held = false; + if (!tgt->fail_held && tgt->noflush_suspend) + requeue = true; + else + held = false; goto unlock; } @@ -4613,6 +4617,12 @@ static bool qcow2_try_hold_error(struct qcow2_target *tgt, struct qcow2_rq *qrq, unlock: spin_unlock_irqrestore(&tgt->event_lock, flags); + if (requeue) { + mempool_free(qrq, tgt->qrq_pool); + dm_requeue_original_rq(rq, true); + return true; + } + if (first) mod_timer(&tgt->held_timer, jiffies + HOLD_TIMEOUT_JI); schedule_work(&tgt->event_work); @@ -4717,7 +4727,7 @@ void qcow2_resubmit_held_qios(struct qcow2_target *tgt) qcow2_submit_embedded_qios(tgt, &list); } -void qcow2_fail_held_qios(struct qcow2_target *tgt) +int qcow2_fail_held_qios(struct qcow2_target *tgt) { struct qcow2_rq *qrq; struct request *rq; @@ -4725,6 +4735,10 @@ void qcow2_fail_held_qios(struct qcow2_target *tgt) LIST_HEAD(list); spin_lock_irq(&tgt->event_lock); + if (tgt->noflush_suspend) { + spin_unlock_irq(&tgt->event_lock); + return -EBUSY; + } tgt->fail_held = true; list_splice_init(&tgt->held_qios, &list); spin_unlock_irq(&tgt->event_lock); @@ -4735,6 +4749,8 @@ void qcow2_fail_held_qios(struct qcow2_target *tgt) dm_complete_request(rq, qrq->held_status); mempool_free(qrq, tgt->qrq_pool); } + + return 0; } int qcow2_clone_and_map(struct dm_target *ti, struct request *rq, diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c index b3365f92c7dd..dd74e7c84b75 100644 --- a/drivers/md/dm-qcow2-target.c +++ b/drivers/md/dm-qcow2-target.c @@ -36,6 +36,7 @@ static void qcow2_set_wants_suspend(struct dm_target *ti, bool wants) spin_lock_irq(&tgt->event_lock); tgt->wants_suspend = wants; + tgt->noflush_suspend = wants && dm_noflush_suspending(ti); spin_unlock_irq(&tgt->event_lock); } @@ -1289,6 +1290,7 @@ static int qcow2_preresume(struct dm_target *ti) spin_lock_irq(&tgt->event_lock); tgt->fail_held = false; tgt->wants_suspend = false; + tgt->noflush_suspend = false; spin_unlock_irq(&tgt->event_lock); } diff --git a/drivers/md/dm-qcow2.h b/drivers/md/dm-qcow2.h index cd73314ee28c..6b719113aeb6 100644 --- a/drivers/md/dm-qcow2.h +++ b/drivers/md/dm-qcow2.h @@ -212,6 +212,7 @@ struct qcow2_target { bool service_operations_allowed; bool wants_suspend; + bool noflush_suspend; bool fail_held; bool md_writeback_error; bool truncate_error; @@ -439,7 +440,7 @@ void qcow2_dispatch_qios(struct qcow2 *qcow2, struct qio *qio, struct list_head *qio_list); void qcow2_submit_embedded_qios(struct qcow2_target *tgt, struct list_head *list); void qcow2_resubmit_held_qios(struct qcow2_target *tgt); -void qcow2_fail_held_qios(struct qcow2_target *tgt); +int qcow2_fail_held_qios(struct qcow2_target *tgt); struct qcow2 *qcow2_ref_inc(struct qcow2_target *tgt, u8 *ref_index); void qcow2_ref_dec(struct qcow2_target *tgt, u8 ref_index); int qcow2_inflight_ref_switch(struct qcow2_target *tgt); diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 5a8cd59ec257..b2fb6f853a41 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -204,11 +204,11 @@ static void dm_requeue_original_request(struct dm_rq_target_io *tio, bool delay_ rq_completed(md); } -void dm_requeue_original_rq(struct request *rq) +void dm_requeue_original_rq(struct request *rq, bool delay) { struct dm_rq_target_io *tio = tio_from_request(rq); - dm_requeue_original_request(tio, false); + dm_requeue_original_request(tio, delay); } EXPORT_SYMBOL(dm_requeue_original_rq); diff --git a/drivers/md/dm-rq.h b/drivers/md/dm-rq.h index 53abc3cf9aee..d04cdb8adda2 100644 --- a/drivers/md/dm-rq.h +++ b/drivers/md/dm-rq.h @@ -46,6 +46,6 @@ ssize_t dm_attr_rq_based_seq_io_merge_deadline_store(struct mapped_device *md, const char *buf, size_t count); void dm_complete_request(struct request *rq, blk_status_t error); -void dm_requeue_original_rq(struct request *rq); +void dm_requeue_original_rq(struct request *rq, bool delay); #endif -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel