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 40B5B8017D for ; Mon, 16 Nov 2026 15:43:08 +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 6AGFfrjV027426; Mon, 16 Nov 2026 18:41:54 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGFfrjV027426 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="e5g7O33X" 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 6AGFfRLA027352 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 16 Nov 2026 18:41:27 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AGFfRLA027352 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-4903fc8537aso2393528f8f.0 for ; Mon, 16 Nov 2026 07:41:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEbyUuafCYOkeOYb/s1cM+fbTzTTEAlCg9GVGnsAQnTaq+CCqxMVrhTlYj7qN4nOpnuWk+ZLg==@openvz.org X-Gm-Message-State: APuU4Z9phYLh2VNEY9S66FLHdH/MN0zVRjoxZ99OE6KnYQOriykDV2r5 smolNJN/5+U25ucUWU84riaRchIrF0gx3b7dk/KDkKSXi/kVMJOZ+z9jLyvYKNfScEvh9jnPsLb FxRgtAiGej9cJ6FwVOEjw9TUg0aJkjbT4tBBaR8RPyPQClomkwIKSGQ== X-Gm-Gg: AZFdTZdu5vGimJZKF25C+zBjhOhv+I13DGHVgVvUsb85lWIrI2tBc1kKpXa1N8+Mvbk 86d5Z5VRyZH5QeIkqoiuXhXYLElq/wwTuyZi7XPnlkjIuRyECCbfoeM8D+98loxdww1gDYJD/Lu m2RjbiqfuNCtUVHp4O2NQInooNN9aBPSy57dZqUeXl9Ho+VU0qUCVVLtF0zN8WSk9NPYSGOE3Se gY4+E3M8Xh1DaivUgAXtUWVsZ5G1RC7DfkD6DTlthor55B49LgEVWgGlvY6LEBleD6QlaQ4fKVz w0e5wnrMZwsHnz/arAxYYxh1a+VvdrM4LL5tKi+yVIWCFV8mh3u7rn74BYOlVeua1DKvytLNdKK CpzT8xttoMvR/DcyCUk1DO2kkslO5 X-Received: by 2002:a05:6000:29c9:b0:493:1004:96f7 with SMTP id ffacd0b85a97d-49c747700f2mr16373582f8f.54.1794843686710; Mon, 16 Nov 2026 07:41:26 -0800 (PST) X-Received: by 2002:a05:6000:29c9:b0:493:1004:96f7 with SMTP id ffacd0b85a97d-49c747700f2mr16373522f8f.54.1794843686200; Mon, 16 Nov 2026 07:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794843686; cv=none; d=google.com; s=arc-20260327; b=qpZ0GWjc4gLs07tHE7lI8iw3j6kmn2T8rg8poCAsPTLHK+4O1EHjLmxYrsctmQnDw3 QXNhfCY4cH40Q+Q0AHzq/j+CurKhIp2j0ZprSLAcKGXeXPLlQVdzK1RfmAjtCukw9PgP TGWJKOiJe62sUKKt4AchvLy1UXIH0QtyMdfy+PohA/AgXFCRRO/arLrBNeHOy0xqvwbs b5vvujivaEdeXDg9EdxByqzs7k9uh6eAEjGGIQpPS9O7ZxE08/SakFwGxiKFkABagTBu fj9zsxfGr0hoEAOsFxE19cftxSRgfSUDxLl+jjCGj03E3VDNosR3v/C3qIXi7PQeisav +sQQ== 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=UUwCZ8N5nVJN68QVF1Z79L5cCDBXbFhUjsyoH1sv0Ec=; fh=CMILZ+goaghq6B4UpCDhf0EQp6kYD0LAlmOkUiVCOvs=; b=V4vSbznBYTEYqCmm7JDuUf0rc3eqXfoZEECB7uUyNAVQHAFWo7ffA2p6d1XIGccUxb 3QTLHEPj508UetMO5dWQ2wvRFnUpZLf5zsIRrvfVttrdXhRe3pT+4qb2jUb+wMGCd6dW vyirwPBBnr1endl+/7Me6/rJeYbfJtaooNXo5Vtav5RPo9c7CQOLscFUI+34wI1wmaQg hXmIi+f1OD+f3XJz7p9W+WvKGXqMjhWHAoPOfutlLXh7Wtswyn1dZrQwSo4+46K/Z6bq hqMLeczJ7We/ePbFsB3m5osK9EmqKye10YlWU1GbcA1SVPslBy1JW6kUvF2E1xZzv8ux TkiQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=e5g7O33X; 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-49c63da3825si21685401f8f.236.2026.11.16.07.41.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Nov 2026 07:41:26 -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=e5g7O33X; 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=UUwCZ8N5nVJN68QVF1Z79L5cCDBXbFhUjsyoH1sv0Ec=; b=e5g7O33XIgGU Hubt/mPPb+4P6ul0mv0Neorq1gkQ8RI8vj5UOxuxbuVCYLgZn0D+prAkrCPQMBTGQ2BS0FRE2rspU v92Ibq58E87wWkkco97gYHPSe6Nn0dGGbSyv697cqqoxSG+GQu5trG6f7brn/WWk3rDRghethc18h yZj7BNGW1dKITJuCpnQQ/4LDJUwaIe6bNYHG+MZmGht0c8gEUqvr7wNEPTDW3Md+lNiYBbDtjvKIp yOEWiH5l83kVg2oAYONU2WYkMFPo44vJJY8r8Yz31ivXSz5iovyuY34FR/CWUcg2NOBzYeiUejyOM tHBeiNuRkJeXpe1hdIdRqw==; 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 1xSylS-005tLh-2S; Mon, 16 Nov 2026 16:41:17 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Mon, 16 Nov 2026 16:41:18 +0100 Message-ID: <20261116154119.2979718-9-alexander.ivanov@virtuozzo.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261116154119.2979718-1-alexander.ivanov@virtuozzo.com> References: <20261116154119.2979718-1-alexander.ivanov@virtuozzo.com> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.1 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. 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