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 3C77A80032 for ; Mon, 23 Nov 2026 15:38:16 +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 6ANFb6Tq021231; Mon, 23 Nov 2026 18:37:07 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ANFb6Tq021231 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=default; t=1795448228; bh=+GKhpVCZKj6scoqThZRBdbH+D+ytpAXQKFG4JwsPTXI=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe; b=qSu7BnO/cDb9R+HEX42w05N/OS45rGcI24sAL913j1Wvs06QFDGqODtUEOWCamMPd /IGViTz1wp5htV+S69WIkvdM57ohOoheLYGtGUyLcYmzHS/awYjp5rnHqIuqwCz+qX OCbruGRQFiaV1zlSDerYQetv/i7bu5yqphsuKdalV4T9XXW0KUGacLzbC6GT4XuFHu zp5EKl9PJc9CGZK+4ihXpTWQcCmjtjcdySCmqEV8Ois2nFpCz5jJerkqt7g+JdI85C 5UgfdM9lLInGqDCzzKpv7KY1O4N6g+IWZkILDtzCNOyKQep7KKTYdxpRaOSxvpus8z 29Tz8427m1UXw== 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 6ANFaq76021165 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=FAIL) for ; Mon, 23 Nov 2026 18:36:52 +0300 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.openvz.org 6ANFaq76021165 Authentication-Results: mail.openvz.org; dkim=pass (2048-bit key) header.d=openvz.org header.i=@openvz.org header.b="b7J/S6pW" Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4a70b42bab0so33624495e9.1 for ; Mon, 23 Nov 2026 07:36:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHWX/wULue0Ebqsx3UO6VXjFSC+6qrfRpMQp1YtvQVsBuptPRbADUVrJ+XHA7nBdIOfqL6Ftg==@openvz.org X-Gm-Message-State: APuU4Z+EQungbBvA0ul7Ccx1Q20Pnw6aRnXNYIQjTiKhrcGLqmu5+cCu TkZP1errbX0i+tsl2HrwP9F4WNwDRvFWtiaJDOz7DI73qEhY3lPzxbrHqJogQNj+V6i6pOVhGwg 5+P41o1zu/xLejrhmbCBrejVjTeglrMtCi9EwyTyS6H9gc35tqGRcMA== X-Gm-Gg: AZFdTZccFxhB0TjyqVHPnvfwlpJ5MNcgu0nBuh35nHDD0boBE4sda4alUaQMVkc7P6E iriOB9bSbjis40k4yCq9wWohpGrQG+buKkQm2oEmooon4q3bwiFPiyO5l83LwB30cjnB8f4KpSB YndLXgZiuxtaMVMpEy/xBa6WeS+TmgGJGaYf3/R5Wxy0iiVpAa9SMsa2JWNITBleJDqxMUBQzzP Itf4KmC/egkfBTQNIH5C9XkKAu+h7gMCMuSnng7gFVoLjmSDaP5Lna7PjRMstPAxe6GuHDqeBcg UybWUJpltQ== X-Received: by 2002:a05:600c:828e:b0:4a2:526b:d40f with SMTP id 5b1f17b1804b1-4bb88785898mr254997695e9.0.1795448211886; Mon, 23 Nov 2026 07:36:51 -0800 (PST) X-Received: by 2002:a05:600c:828e:b0:4a2:526b:d40f with SMTP id 5b1f17b1804b1-4bb88785898mr254997105e9.0.1795448211422; Mon, 23 Nov 2026 07:36:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795448211; cv=none; d=google.com; s=arc-20260327; b=VLm9/DZfIqP5w6xrlAlLp5uqNaNle/8d7oozSNI6mJ77wwNjHY+AAD6xSAQgabJMsu D9ygYOOMeW8eHI8YN2cRSlkhmTyeUZ7DHFdPXf8qc0NjqKMUEZbAEx+UZ5+K33FsFN6c lGCgaSAYUza/z9wq1SExpJF20CXNhYdrPbbgUkpF/yyY9AzI9se+hF6Ni+eqD+sqGP/p 3wdbEn0UVVZQqHLzsu0Y3SGmc0bKqaKFOGhMuF6gqUcSfMXurCE+E8h7N46SIyXRpZVj FWYVTYSaJOV1BFXNrt7JX8iiKVXKeXElk8ljVQ4Mq+GYxzDQ8J/mD+9qaUlbaWmYSV96 30ug== 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=aEXaIuGuSbadadbsO2SfGqxijTTtLQdBCO9lPO/QAaE=; fh=q9wcwiVXIDPUmbL2Svblp5YzTHTuXq4S9fAA44rlW5c=; b=HDs+bPCGKAqeVRp1pZgLvwqtOq/yJlz5z2/2WVQKPdYMs8YLy0BoRptUxk5gJZo/gZ 1W0VsgyxFO5j1yheO8/Zd3lemzFudadQQbSYeskx8erYH9eLfftzrXzThxAyTRW0vxLc sgB79CxPdYKuR0gtqapHn8b5kbcydpRhbHDrsKbT0xLvZr0NaixrvSJ80BcpJr24Sq+y KRhsoy4ozYE7r8WQXFixjoDjayRESzEWEbracxnUIBGEpEZKdRFbzNTToq5QaPgbTp/a rJmS/pdmfmwdJitbBUhLyCHwydLeZL+0sKoWeEXm+YS/dlwEEgGBcHjH9EyilLSES9PE SScw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b="b7J/S6pW"; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:62d2:2eda:8655:4219 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-4bb852a12d6sor18833855e9.0.2026.11.23.07.36.51 for (Google Transport Security); Mon, 23 Nov 2026 07:36:51 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:62d2:2eda:8655:4219 as permitted sender) client-ip=2a06:5b06:b600:300:62d2:2eda:8655:4219; Authentication-Results: mx.google.com; dkim=pass header.i=@openvz.org header.s=google header.b="b7J/S6pW"; spf=softfail (google.com: domain of transitioning den@openvz.org does not designate 2a06:5b06:b600:300:62d2:2eda:8655:4219 as permitted sender) smtp.mailfrom=den@openvz.org; dara=neutral header.i=@openvz.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvz.org; s=google; t=1795448211; x=1796053011; darn=openvz.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=aEXaIuGuSbadadbsO2SfGqxijTTtLQdBCO9lPO/QAaE=; b=b7J/S6pW2rafKJzWhmVgj+rlzahfI0hDOGi+ijyik7we2Bqxqxoidfg+8ELPR0cjNk ihL/OwOsV8LWBh2ynrIo/cSkSq/a2QQweDnRYFInI+qJVvyjF0Ij8hn24NB834FhQ/9i eewpBFapj/IPET6cidazG4EezqPRb/gn2scf5fa77puk457TjPxkpTcNXogsaZh5E3kE 8cVLXWESBrlzI74701VrSZumnCcy0l/+5OvR78LA9Pwc3OVYwiE5XvsC2sXY+nDFSNI8 4N2cnbR7ytD3JV9BTS0xIgTvB1ttFbOvwpFl4IWLatpT0FigC0K//YtwZZgF+Hfj7jWQ RB0A== X-Forwarded-Encrypted: i=1; AL+hErFtkMXP/v8h8dMyqGWbZH525Dh1PKS4ZljySaRTJa6/pQoHsWsWarqncGNzUgxNEogZFVEpnw==@openvz.org X-Received: by 2002:a05:600c:a085:b0:4bb:85d9:156e with SMTP id 5b1f17b1804b1-4bb8880fe46mr245994745e9.11.1795448210923; Mon, 23 Nov 2026 07:36:50 -0800 (PST) Received: from artemis.sw.ru ([2a06:5b06:b600:300:62d2:2eda:8655:4219]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb884b7515sm491797455e9.13.2026.11.23.07.36.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2026 07:36:50 -0800 (PST) From: "Denis V. Lunev" To: andrey.zhadchenko@virtuozzo.com, alexander.ivanov@virtuozzo.com, vasileios.almpanis@virtuozzo.com Date: Mon, 23 Nov 2026 16:36:38 +0100 Message-ID: <20261123153640.128227-7-den@openvz.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261123153640.128227-1-den@openvz.org> References: <20261123153640.128227-1-den@openvz.org> MIME-Version: 1.0 X-OZ-Fwd: true Cc: devel@openvz.org Subject: [Devel] [PATCH hci-8.2 v2 6/8] dm-qcow2: stop slow_wb_timer and flush the workers before freeing an image 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 From: Denis V. Lunev qcow2_flush_deferred_activity() ends with an inflight reference switch that waits for the metadata writeback it started. Those qios are ended by the image's fsync_worker, and each completion queues that worker before the qio is taken, so one run can end the last qio while another run stays queued. qcow2_merge_backward_complete() then frees the merged image with that work still pending, and it runs on freed memory. Shut slow_wb_timer down and flush both workers of the merged image before truncating and freeing it. The timer is not expected to be armed after the final flush pass, which writes without retrying on ENOSPC, but qcow2_destroy() only warns about a pending one. In qcow2_tgt_destroy(), shut down the timer of every image before destroy_workqueue() drains the remaining work, for the same reason. https://virtuozzo.atlassian.net/browse/VSTOR-156036 Fixes: 222b6f1291c1 ("dm-qcow2: Introduce driver to create block devices over QCOW2 files") Feature: dm-qcow2: block device over QCOW2 files driver Signed-off-by: Denis V. Lunev --- drivers/md/dm-qcow2-cmd.c | 3 +++ drivers/md/dm-qcow2-target.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/md/dm-qcow2-cmd.c b/drivers/md/dm-qcow2-cmd.c index fb3d1e014046..783159b0161c 100644 --- a/drivers/md/dm-qcow2-cmd.c +++ b/drivers/md/dm-qcow2-cmd.c @@ -392,6 +392,9 @@ static int qcow2_merge_backward_complete(struct qcow2_target *tgt) smp_wmb(); /* Pairs with qcow2_ref_inc() */ qcow2_inflight_ref_switch(tgt); /* Pending qios */ qcow2_flush_deferred_activity(tgt, qcow2); /* Delayed md pages */ + timer_shutdown_sync(&qcow2->slow_wb_timer); + flush_work(&qcow2->worker); + flush_work(&qcow2->fsync_worker); qcow2->lower = NULL; if (qcow2_file_is_writable(qcow2)) { diff --git a/drivers/md/dm-qcow2-target.c b/drivers/md/dm-qcow2-target.c index 2a51beaebcab..d5e94753ddbb 100644 --- a/drivers/md/dm-qcow2-target.c +++ b/drivers/md/dm-qcow2-target.c @@ -252,6 +252,8 @@ static void qcow2_tgt_destroy(struct qcow2_target *tgt) * since DM waits them. Complete our deferred: */ qcow2_flush_deferred_activity_all(tgt); + for (qcow2 = tgt->top; qcow2; qcow2 = qcow2->lower) + timer_shutdown_sync(&qcow2->slow_wb_timer); /* Now kill the queue */ destroy_workqueue(tgt->wq); } @@ -264,6 +266,7 @@ static void qcow2_tgt_destroy(struct qcow2_target *tgt) for (i = 0; i < 2; i++) percpu_ref_exit(&tgt->inflight_ref[i]); + qcow2 = tgt->top; while (qcow2) { lower = qcow2->lower; qcow2_destroy(qcow2); -- 2.55.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel