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 DC72C8017D for ; Tue, 17 Nov 2026 10:45:24 +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 6AHAiFPb008392; Tue, 17 Nov 2026 13:44:16 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHAiFPb008392 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="FzFYRUob" Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by mail.openvz.org (8.14.4/8.14.4) with ESMTP id 6AHAhXwF008313 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Tue, 17 Nov 2026 13:43:33 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHAhXwF008313 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a70b42bab0so7046605e9.1 for ; Tue, 17 Nov 2026 02:43:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErEtFIwWR0QPQc5PsdipjoCvl9EuzpB1stgrmPmwg9FWsqDGVOyggcaHVr5chri9RdCRFPyz7Q==@openvz.org X-Gm-Message-State: APuU4Z96Yyu2gnBnK/bfU4UQYSahevqDQQVDts/6QI8HHdI+aL1G+XhR npFjzB9kaSnCjqxjaRn/D3DQbWh805d301m5KeUt6mdOz7xffhvd+z1LWHfQNwgNO1Hyk76Z1RD Pqoz5NUDeMHT62dcutXzCG7lSE0IHMUKX3xDAqQCTSQXxgJMoWtovQQ== X-Gm-Gg: AYBFou1KT3sv2knMprLjpOI6hVzMT4/sR5urirnY9CWuHNGxoFUPBUVc1iqzyvpmH4y fV5+Aqvdymf5S1lSJIBt0p40NuONONWOcJvkypEJJtSHygTtTLKPtrss3fHC8R58TGsFGPegIGu vr1zHBeLf8gJXZZonaHCEh5PdPba//1QkRjfxS5E2BTB76uo5TSYgzzcE1PaKK94qO/Z6lFYKZE IFSJ3qoD27RmWthACr3a9fA6dIKtekilePhQ0lVGlolXXk759/COj/W4USIA9icLjUZsp71u4AI e5HhTY/z0wt56uoyNDaXiu8DunLvAhNqQ8TE0UUzbli04Ek3+eHGyU1PE3IUshTVtqYKxfPgy0R ESDBIAEgIn53Kj6MXcX2oNwUDTTo= X-Received: by 2002:a05:600d:1c:b0:4bb:7ad9:311d with SMTP id 5b1f17b1804b1-4bb7ad95a0fmr14792305e9.19.1794912213146; Tue, 17 Nov 2026 02:43:33 -0800 (PST) X-Received: by 2002:a05:600d:1c:b0:4bb:7ad9:311d with SMTP id 5b1f17b1804b1-4bb7ad95a0fmr14791965e9.19.1794912212667; 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=JQfISqobo3WBbEiLcdI7YbY0pMDMPO4qUSNwIFsQHLbFt0hH0IQd8tgC0NyosMN128 /VFlDEy74DHJSOvLttnUTr50vbtnt0lhYhFyAQCxpLsNs9/BiNEeqLsZgQk91QzRUf2T rnaIn/U93/x/M65iyv6O7XDtXLVQpYvuRhJWiF5tH4TLFoDU3w3jt05GH9+aeQW01pbs Ve9osUb7ex2vjWdwqCafImxVj0G9Zrji1d9YwbxtQldpPWnXrBV0D3PyI7co158ie04M +wNEN6/fr9JICs/AAg3HLZISP2nXB5HG6b9pIeEaDkzTZO/DO0aaR6ylJ2gOo43nCEH3 JIdQ== 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=7wCkMyzsaXS9KtIMaUSuJnHA1FB9M2ifivKhRo91Dh8=; fh=CMILZ+goaghq6B4UpCDhf0EQp6kYD0LAlmOkUiVCOvs=; b=cDz6D9B75DXr+WEVj1blfXFFcFa1r9BB2nuio+SXVV4ddSLb58s9yxdPLBpmTeZfz4 SyMfEupOyfzT2pmYjMxVh/eczyMnEoOlyv8QGVzgnwEjItG9ndAO7DGi31ski+krG4te SibbF5MtE9zEoHGOHJxMq6fUYrs4QfZIXVVjpHKGjwQupn3AAh3VLNK1GgSxYpkeoou0 CIAWuXUJEd0pPyimpd+QscuhgtOJUvknvQujhOANaySc9nTUo6z86uWUzgKTVDLbptUK kxpUJTgGhLMBv3QpOEO9WultsQdxtC0+AgIb9fkF8qwI3y6aaUIMIat5hf+jUGQBksOs 017A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=FzFYRUob; 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-49c64b09cbesi27156840f8f.386.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=FzFYRUob; 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=7wCkMyzsaXS9KtIMaUSuJnHA1FB9M2ifivKhRo91Dh8=; b=FzFYRUobRvJK bboAwgxwYDoxqmrKDO7Ey3q5YSFPOr/hx2Y1VLw+8rIQ2xZwWsh+L1GgWsGgNvHI2VALdWyQJoW27 wSwVG5LpJb8fvlI4C9i/JPVslwg7tjU77Gcq7w4GAcpjtSgRbB3oAoeRao5iyxFc5RhmsGcl9T4cQ 4Tnn8X0sWvZpVH+kEbbv+Q+gao2sn0WYl+qJWP/atb/B3OgFA5kj3piKAPuaX3kxT4FA9sWSTdDNQ 01P94xTyep0Z6Ds28RwzQfQgBBd5P+u/JeGADuQx8fzV9KdlBKwTYnUzDJtI0/x1khOmThkY5Bu88 aywKeann72mR5elxjyXKnw==; 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 1xTGah-009vj8-3A; Tue, 17 Nov 2026 11:43:22 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Tue, 17 Nov 2026 11:43:26 +0100 Message-ID: <20261117104329.3079812-7-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 6/9] drivers/md/dm-qcow2: add the resubmit and fail_held messages 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 Held requests are retried every 20 seconds. QEMU pauses the VM on the IO_ERROR uevent, and the requests should be retried as soon as the VM is resumed, and dropped if the VM is destroyed: vhost-blk waits for all in-flight requests on release, so a request held while the error persists leaves QEMU in D state. QEMU has no CAP_SYS_ADMIN, so libvirt sends the messages: resubmit - resubmit the held requests now fail_held - fail the held requests and stop holding new ones until resubmit or resume fail_held has to be sticky: requests in flight when it arrives, a timer resubmission included, fail later and would otherwise be held again with the timer rearmed. https://virtuozzo.atlassian.net/browse/VSTOR-152175 Feature: dm-qcow2: block device over QCOW2 files driver Signed-off-by: Alexander Ivanov --- drivers/md/dm-qcow2-cmd.c | 21 +++++++++++++++++++++ drivers/md/dm-qcow2-map.c | 35 ++++++++++++++++++++++++++++++++++- drivers/md/dm-qcow2-target.c | 16 +++++++--------- drivers/md/dm-qcow2.h | 4 ++++ 4 files changed, 66 insertions(+), 10 deletions(-) diff --git a/drivers/md/dm-qcow2-cmd.c b/drivers/md/dm-qcow2-cmd.c index 7af3ac154127..ea9c69b454ea 100644 --- a/drivers/md/dm-qcow2-cmd.c +++ b/drivers/md/dm-qcow2-cmd.c @@ -643,6 +643,27 @@ int qcow2_message(struct dm_target *ti, unsigned int argc, char **argv, } ret = qcow2_get_event(tgt, result, maxlen); goto out; + } else if (!strcmp(argv[0], "resubmit")) { + if (argc != 1) { + ret = -EINVAL; + goto out; + } + spin_lock_irq(&tgt->event_lock); + tgt->fail_held = false; + spin_unlock_irq(&tgt->event_lock); + timer_delete(&tgt->held_timer); + qcow2_resubmit_held_qios(tgt); + ret = 0; + goto out; + } else if (!strcmp(argv[0], "fail_held")) { + if (argc != 1) { + ret = -EINVAL; + goto out; + } + timer_delete(&tgt->held_timer); + qcow2_fail_held_qios(tgt); + ret = 0; + goto out; } else if (!strcmp(argv[0], "merge_backward")) { if (argc < 2) { ret = -EINVAL; diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index 2a663eb652f4..b2962c77cc15 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -4577,12 +4577,13 @@ static bool qcow2_try_hold_error(struct qcow2_target *tgt, struct qcow2_rq *qrq, return false; spin_lock_irqsave(&tgt->event_lock, flags); - if (unlikely(tgt->wants_suspend)) { + if (unlikely(tgt->wants_suspend || tgt->fail_held)) { held = false; goto unlock; } init_qrq_and_embedded_qio(tgt, qrq->rq, qrq, qio); + qrq->held_status = bi_status; pr_err_once(QCOW2_FMT("underlying disk is almost full"), qcow2_device_name(tgt->ti)); @@ -4689,6 +4690,38 @@ void qcow2_submit_embedded_qios(struct qcow2_target *tgt, struct list_head *list qcow2_submit_embedded_qio(tgt, qio); } +void qcow2_resubmit_held_qios(struct qcow2_target *tgt) +{ + unsigned long flags; + LIST_HEAD(list); + + spin_lock_irqsave(&tgt->event_lock, flags); + list_splice_init(&tgt->held_qios, &list); + spin_unlock_irqrestore(&tgt->event_lock, flags); + + qcow2_submit_embedded_qios(tgt, &list); +} + +void qcow2_fail_held_qios(struct qcow2_target *tgt) +{ + struct qcow2_rq *qrq; + struct request *rq; + struct qio *qio; + LIST_HEAD(list); + + spin_lock_irq(&tgt->event_lock); + tgt->fail_held = true; + list_splice_init(&tgt->held_qios, &list); + spin_unlock_irq(&tgt->event_lock); + + while ((qio = qio_list_pop(&list)) != NULL) { + qrq = qio->endio_cb_data; + rq = qrq->rq; + dm_complete_request(rq, qrq->held_status); + mempool_free(qrq, tgt->qrq_pool); + } +} + int qcow2_clone_and_map(struct dm_target *ti, struct request *rq, union map_info *info, struct request **clone) { diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c index 2a57f66fe25d..590c2e6a4bec 100644 --- a/drivers/md/dm-qcow2-target.c +++ b/drivers/md/dm-qcow2-target.c @@ -484,14 +484,8 @@ static void inflight_ref_exit1(struct percpu_ref *ref) static void qcow2_held_timer(struct timer_list *timer) { struct qcow2_target *tgt = timer_container_of(tgt, timer, held_timer); - unsigned long flags; - LIST_HEAD(list); - spin_lock_irqsave(&tgt->event_lock, flags); - list_splice_init(&tgt->held_qios, &list); - spin_unlock_irqrestore(&tgt->event_lock, flags); - - qcow2_submit_embedded_qios(tgt, &list); + qcow2_resubmit_held_qios(tgt); } static void qcow2_send_io_error_uevent(struct qcow2_target *tgt, @@ -1247,8 +1241,12 @@ static int qcow2_preresume(struct dm_target *ti) if (ret) QC_ERR(ti, "Can't set features"); } - if (!ret) - qcow2_set_wants_suspend(ti, false); + if (!ret) { + spin_lock_irq(&tgt->event_lock); + tgt->fail_held = false; + tgt->wants_suspend = false; + spin_unlock_irq(&tgt->event_lock); + } return ret; } diff --git a/drivers/md/dm-qcow2.h b/drivers/md/dm-qcow2.h index 03233090da23..df20826c6060 100644 --- a/drivers/md/dm-qcow2.h +++ b/drivers/md/dm-qcow2.h @@ -206,6 +206,7 @@ struct qcow2_target { bool service_operations_allowed; bool wants_suspend; + bool fail_held; bool md_writeback_error; bool truncate_error; bool event_io_error; @@ -345,6 +346,7 @@ struct qio_ext { struct qcow2_rq { struct request *rq; struct bio_vec *bvec; + blk_status_t held_status; }; struct qio; @@ -426,6 +428,8 @@ void qcow2_init_qio(struct qio *qio, unsigned int bi_op, struct qcow2 *qcow2); 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); 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); -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel