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 016C48017D for ; Tue, 17 Nov 2026 10:12:02 +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 6AHAAoJP007819; Tue, 17 Nov 2026 13:10:51 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6AHAAoJP007819 Authentication-Results: mail.openvz.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=virtuozzo.com header.i=@virtuozzo.com header.b="HlxsMvia" 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 6AHAAVpP007755 (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 6AHAAVpP007755 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4bb6bbc025aso18496205e9.3 for ; Tue, 17 Nov 2026 02:10:31 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErFm24ZZfndZ4RJYQx8nM2sUfqM2qutZY+N2zgApCmxr1f/Lt1ZHitAQ5tZBluNfz4gOk0y8JQ==@openvz.org X-Gm-Message-State: APuU4Z85pUbLpedXmeU79Xkf1LoMpu4nhO9IhKyd0tn1RDN4ehc12zxo JIBv6HVpnoJhY6ZU70xTWyICu0DTZ+UXQHgpsOOUZ/mHLS8/EWwjU4Pmo+eN+BgXY2sZ6cv379z wERZuS3uL7FkusG4Zck3UfQtnUddwMNZoeDw5VJcEGUmuVxyneJTYLg== X-Gm-Gg: AYBFou21+oR2Tv8TdyyB1tPU2j16g5jXtwjq3ZXg8k84TvK69+Bped/GNy0v3Lq+wZL +lWIvpkndt1DHMQxABFDxe9l3O7DBDk7mbNOF41IR9khIhzL3l8w7FyqX84ZigRGUhQJTAxCCQQ QbhcozhGDfxrHwoiKwvddZd3SWr4kdqm9gJg54f2Rvh6ethv2fIRyt10SuXxK/uibKD6m8t8Azb mHtIh3n8AQVUfQRe4UTOmoBQ1FIICf5yrTHAmK028VSOY/vKrDwcX34ie7VgtcTaMW980TPer9p A7PcM9E4RvO/cyEPHQGuCoPtfhoXySPj0Fwh25F6wrZS2sp1FDNn6Xcf3kmti5kMhdm5E52Uc+i l8G1khdOfqHhCTNBLvhuuyeDeFU8= X-Received: by 2002:a05:600c:3547:b0:4b6:267a:dd6e with SMTP id 5b1f17b1804b1-4bb55a8a402mr270293695e9.28.1794910230655; Tue, 17 Nov 2026 02:10:30 -0800 (PST) X-Received: by 2002:a05:600c:3547:b0:4b6:267a:dd6e with SMTP id 5b1f17b1804b1-4bb55a8a402mr270293325e9.28.1794910230202; 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=PN/i0rWL7CeYkmkuVT0vVWOWJpkkQNk5fgvLwTILmwR3U/XStXvm+RMe4h6lOa2/Am ODjfbgJWJmgpCkl6102KVCyi3ZeYsiN6A7xZ5SsduDtxKQETMcek4BInsIyTlXAy/TuD G9M0zeMOLceI2pDwPwAMTfb0VUJ0b/0WkxPBBSAhyzexIUjSAkVgUXqYLRZ6OSw3/zlo 20gBxUHKk5JUNr0CyRqVgAt1+infqG3dyaZWrSvAgnedH6LH+8RFKNntPwiVhIXCZfJj +vH6yFf349rvpT2v3FHbgiaLDVS3xAisUNtFsJ/mMdihR5LeXAGD0Ig6yThNXJD2sAWA PBMA== 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=qLsxE8ruOLKgqkJxEIzITuAM78ElbARbQMrgSISPyRE=; fh=CMILZ+goaghq6B4UpCDhf0EQp6kYD0LAlmOkUiVCOvs=; b=qSjf2Ug9tPKOtccXvabYLr/HWOdxKMIqZPb2yCBwOITMzFFW236KlUVCLSSuE8vPo7 XQoTqIG+6gLllN2UHbl57AxWJs1mltGvvPW4Wrtuhp6xuTFHJGJABuCb0MvUY+s6skJ7 h2jcPKhrC6ufRa8plKcwHlkBuDd759s0dkbImHKR0EQh3LG7SmFuol1jt6NEx+mNkp58 X/XeXGtsfdPL4wrUUuC2l4HRw5+EE2iDlVxZ/UZzjN3QdfRkrMvtmsip25wLvU7IossR q755ttYxnviZ3pC/pUNNmAuT5CiEnz6UlLS71Okli7xLJYEudx5S2M9CCodkOA6F3FH0 GwJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=relay header.b=HlxsMvia; 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-49c6426cbd7si27280486f8f.282.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=HlxsMvia; 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=qLsxE8ruOLKgqkJxEIzITuAM78ElbARbQMrgSISPyRE=; b=HlxsMvia+RQ3 hh5BYHht1IYErLrqslgsK6yXr0DfFKxflJkLmn+eUSCjdKzI9HmjUINsOccsdXC9RfRCtNPnuVL29 pLd2+RuhjTJajmb2zqwFg8q43gpCiIkgM/RlFSa0dc8H0i/UfazywE97h4nw7Ei3wWHA4fr5WLfJQ w32YqKfOTE5INzof1SVouxbq0HTlQW34M0NpzfjSSG1/quA/mBlqmlcGJ31TXYXUUvmEjmPoKiC6w TEoNEJyidAmIxUc8F+8f+sc3HSLyoEvRxBuQ1gAzxij1SjGed6tyNwIfiPoNBVH76fKEqjU4202Tx pO14p5F+zoKlyQ3DThScGA==; 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 1xTG4j-009Isp-1p; Tue, 17 Nov 2026 11:10:20 +0100 From: Alexander Ivanov To: andrey.zhadchenko@virtuozzo.com Date: Tue, 17 Nov 2026 11:10:22 +0100 Message-ID: <20261117101026.3071579-6-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 5/9] drivers/md/dm-qcow2: report held requests with an IO_ERROR uevent 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 QEMU is to pause the VM when dm-qcow2 holds a failed request, but it cannot use dm_table_event(): waiting for dm events needs dm ioctls and CAP_SYS_ADMIN, which QEMU does not have. libvirt already passes QEMU a NETLINK_KOBJECT_UEVENT socket to watch the vhost-blk disk for RESIZE=1 change events. Send a change uevent on the dm disk with IO_ERROR=1 IO_ERROR_OP=read|write IO_ERROR_ERRNO= when the held list turns non-empty. A periodic retry that fails again repopulates the list, so the event is repeated while the error persists and a lost netlink message is not fatal. This applies to every dm-qcow2 device: a disk whose underlying storage stays full, such as a container disk, now gets a change uevent and a udev probe on every retry, that is every 20 seconds. Only ENOSPC is held for now, for reads as well as writes; the op and errno are reported so that other held errors need no new interface. A flush is reported as a write, as QEMU does. The event carries no DM_COOKIE, so udev handles it as a spurious change and probes the disk, as it does after a close or a resize. A cookie with the flags that disable the disk rules would avoid the probe but makes 13-dm-disk.rules drop the by-id and by-uuid links, and the flags stay in the udev database after the error is gone. The probe only reads, but a read that fails with ENOSPC is held too, so the probe may wait for the next retry like any other reader. get_event keeps reporting a held ENOSPC as "event_ENOSPC", which dm-ploop answers too, and reports other held errors as "event_io_error ". 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 | 11 ++++++++--- drivers/md/dm-qcow2-map.c | 8 +++++++- drivers/md/dm-qcow2-target.c | 28 ++++++++++++++++++++++++++++ drivers/md/dm-qcow2.h | 5 ++++- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/drivers/md/dm-qcow2-cmd.c b/drivers/md/dm-qcow2-cmd.c index 3bccce090f01..7af3ac154127 100644 --- a/drivers/md/dm-qcow2-cmd.c +++ b/drivers/md/dm-qcow2-cmd.c @@ -584,10 +584,15 @@ static int qcow2_get_event(struct qcow2_target *tgt, char *result, unsigned int int ret = 0; spin_lock_irq(&tgt->event_lock); - if (tgt->event_enospc) { - ret = (DMEMIT("event_ENOSPC\n")) ? 1 : 0; + if (tgt->event_io_error) { + if (tgt->event_errno == ENOSPC) + ret = (DMEMIT("event_ENOSPC\n")) ? 1 : 0; + else + ret = (DMEMIT("event_io_error %s %d\n", + tgt->event_write ? "write" : "read", + tgt->event_errno)) ? 1 : 0; if (ret) - tgt->event_enospc = false; + tgt->event_io_error = false; } spin_unlock_irq(&tgt->event_lock); diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c index d6f8bcd98a39..2a663eb652f4 100644 --- a/drivers/md/dm-qcow2-map.c +++ b/drivers/md/dm-qcow2-map.c @@ -4569,6 +4569,7 @@ void do_qcow2_fsync_work(struct work_struct *ws) 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; unsigned long flags; @@ -4585,8 +4586,13 @@ static bool qcow2_try_hold_error(struct qcow2_target *tgt, struct qcow2_rq *qrq, pr_err_once(QCOW2_FMT("underlying disk is almost full"), qcow2_device_name(tgt->ti)); - tgt->event_enospc = true; + tgt->event_io_error = true; first = list_empty(&tgt->held_qios); + if (first) { + tgt->event_uevent = true; + tgt->event_write = write; + tgt->event_errno = -blk_status_to_errno(bi_status); + } list_add_tail(&qio->link, &tgt->held_qios); unlock: spin_unlock_irqrestore(&tgt->event_lock, flags); diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c index 89b12c4f971b..2a57f66fe25d 100644 --- a/drivers/md/dm-qcow2-target.c +++ b/drivers/md/dm-qcow2-target.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "dm.h" #include "dm-qcow2.h" @@ -493,11 +494,38 @@ static void qcow2_held_timer(struct timer_list *timer) qcow2_submit_embedded_qios(tgt, &list); } +static void qcow2_send_io_error_uevent(struct qcow2_target *tgt, + bool write, int err) +{ + struct mapped_device *md = dm_table_get_md(tgt->ti->table); + char op[24], errno_env[24]; + char *envp[] = { "IO_ERROR=1", op, errno_env, NULL }; + unsigned int noio_flag; + + snprintf(op, sizeof(op), "IO_ERROR_OP=%s", write ? "write" : "read"); + snprintf(errno_env, sizeof(errno_env), "IO_ERROR_ERRNO=%d", err); + + noio_flag = memalloc_noio_save(); + kobject_uevent_env(&disk_to_dev(dm_disk(md))->kobj, KOBJ_CHANGE, envp); + memalloc_noio_restore(noio_flag); +} + static void qcow2_event_work(struct work_struct *ws) { struct qcow2_target *tgt = container_of(ws, struct qcow2_target, event_work); + bool uevent, write; + int err; + + spin_lock_irq(&tgt->event_lock); + uevent = tgt->event_uevent; + tgt->event_uevent = false; + write = tgt->event_write; + err = tgt->event_errno; + spin_unlock_irq(&tgt->event_lock); dm_table_event(tgt->ti->table); + if (uevent) + qcow2_send_io_error_uevent(tgt, write, err); } static struct qcow2_target *alloc_qcow2_target(struct dm_target *ti) diff --git a/drivers/md/dm-qcow2.h b/drivers/md/dm-qcow2.h index ea6bc6258cb0..03233090da23 100644 --- a/drivers/md/dm-qcow2.h +++ b/drivers/md/dm-qcow2.h @@ -208,7 +208,10 @@ struct qcow2_target { bool wants_suspend; bool md_writeback_error; bool truncate_error; - bool event_enospc; + bool event_io_error; + bool event_uevent; + bool event_write; + int event_errno; atomic_t service_qios; struct wait_queue_head service_wq; -- 2.53.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel