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 35CB1817C6 for ; Tue, 17 Nov 2026 10:12:09 +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 6AHAAuVt007833; Tue, 17 Nov 2026 13:10:57 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHAAuVt007833 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="gl8AlOQ8" Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AHAAVfY007766 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 17 Nov 2026 13:10:31 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHAAVfY007766 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-4915ba023d4so1993945f8f.0 for ; Tue, 17 Nov 2026 02:10:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHaw4qU5F0aktdMslDCfpiMvDVcpjCfMzYRJ7uyWpdLw5yQN6fhmTLRxQeeG46KLcTmaC3p9A==@openvz.org X-Gm-Message-State: APuU4Z+wHwMCA1tZ0c3bIMXTW2TQak6qA/Y3wSP/o5hvkt3qeWBzLQDJ KpKmjqtP/UxaWwQ2MgVx6r1eQO0K17rRJDNTvxVnFXyVQpmn8anxzpWEVLhNfuELeaFpl2lWnOO rfPcVP2ERhdpfGVhEdLEJrAtS6jnHjjZEDMJpaG/p3bIPGO/n9VpDuQ== X-Gm-Gg: AZFdTZeOerXn1ntySYPrkCVYsKACLnt+3HVSE9bAcWczr6cd5+mM9FhNNNLQR2PasfG xqTm232p5KVBvHJeLViWdbF46uZew5FScdDLIoqrip6rK6AaxjkcTwrvIDIMISfzuVsebh3Lftb czYI3hYZtYXEH3gRrbzvwjZDZqv+KgFeTcq58tqRtBKTTk+VhZgT6zh0dHQ+tOSz6tE3fq+Qkea +p7I7q8aaOb7AXoPZEip5hHy5yqo+CmSXwfRuzWeALstiJUSsmqbi7LdEW3yeCobmct4EJVYhng 7URfIrxHhEOYogSR9RskMPCkhdUDEVE+R1nmuuesFNUQGZcyhh8nSQpZrxGxznc9WQn4q1OuAhs 0YanI6eIUXkLRGTGbT1fK3prgG4hV X-Received: by 2002:a05:6000:41cd:b0:4a3:e484:6ef1 with SMTP id ffacd0b85a97d-4a3e493b226mr2937801f8f.16.1794910231357; Tue, 17 Nov 2026 02:10:31 -0800 (PST) X-Received: by 2002:a05:6000:41cd:b0:4a3:e484:6ef1 with SMTP id ffacd0b85a97d-4a3e493b226mr2937758f8f.16.1794910230803; Tue, 17 Nov 2026 02:10:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794910230; cv=none; d=google.com; s=arc-20260327; b=oVHMEgnkzcsmMr/4A8tc1Q6yJsuxTFN5V6gk7KfNQT7r0CO7yxRqEaUV+FyyMmvEpI 7NyIj4hSgGRO6viKbFC6xVT1kk0mNiucY9n+OvuL1OK0OOkfShl61yf+L/npfE5hms7U LLyG6eSo8JogfM2YWS2tbaApXNCuHnuUEUJbkDnk9nVE1Ko4idOa4n5RwsGeaZI/+hmq Q93GIXmnCcWwvgrjw33xrjLcg3Q5TZZEmAKnqHwqUJLPvJkJShJr2a9D+ejL8EacxeEJ viGYfrL1VKikM60ip8ArqJAC93U3oLQew94W0Ou9vIBtIXei2ToXrGbJhScEvgKG8qb+ FtRg== 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=BELDRyD4/0dHGuN8PjGPj9jmZRHYgz5w8pa+VVEm90Svyj46NhCuxGFHcPQGdQxVU1 dzOAn+MQGYw2A/XVMBElIX1QuzT4K2teLEQuBlrfgWXBug4dq8CiPnfJtl91rpFalnnh rN6COhuVKfzaRLlOZqA7hs4N+6BoYPmt0+jV/2E6IBTbAfdoO9x6bcIpYNNzANRDLtZ8 861VwzEkVkfhSj2vDlyqIMTyjfPJvw03DexUh7+sPCIGQQkrSM/P8yPRz28lGvKN+1AK 2IrRlGh8fmIGB9JpzoJhzhb8QElq0fdhLu78pui5dE/z2BU7Vjemg+7CgEfxYsQMEkV2 hauQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=gl8AlOQ8; 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 ffacd0b85a97d-4a3625553ffsi4436090f8f.87.2026.11.17.02.10.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2026 02:10:30 -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=gl8AlOQ8; 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=gl8AlOQ8TmCm nfgWpq+tDr6uh2Rccd+CD+JB9ZNEXA81QXNRigHiiDgmwDZ3jbcxkhGUFANQcOSorWVt18vB5QA8y knhEpxAhQfY7SU92n9zyM+aUSQlF37eKnANfzm4cFmktoYufAW6PGB9OJ0zUu2g5HCzwmNCM+9Lvi saNI6v0P2PLuOhSc7pNxBM0r1BGBse3dFkKgaF3Qk6ZxDduZrbgEGFapvaEGIDg5kfEShkG/ibQiz Y6qS3Px+Yfn0jHaNjQPDaowcVCFraLd9iWhEQs6Q2S99YAq6B1AoFI7jQzRNRwCxgjUcsPXa4SHVZ t5jB+tSHHI50sBMuIepGsw==; 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 1xTG4k-009Isp-0g; Tue, 17 Nov 2026 11:10:20 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Tue, 17 Nov 2026 11:10:25 +0100 Message-ID: <20261117101026.3071579-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261117101026.3071579-1-alexander.ivanov@virtuozzo.com> References: <20261117101026.3071579-1-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 v2 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