all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH zfsonlinux v2] patches: fix for zvol sync/flush regression
Date: Thu, 13 Mar 2025 12:32:14 +0100	[thread overview]
Message-ID: <20250313113214.23456-1-f.gruenbichler@proxmox.com> (raw)

this broke with 2.2.7, and can potentially cause data loss or
inconsistency. the patch basically reverts to pre-2.2.7 behaviour,
verified via a fio benchmark.

reported on our forum: https://forum.proxmox.com/threads/163066

cherry-picked from upstream master

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
v2: added Stoiko's T-b/R-b, replaced patch with equivalent upstream
master one

 ...vols-correctly-detect-flush-requests.patch | 63 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 64 insertions(+)
 create mode 100644 debian/patches/0012-linux-zvols-correctly-detect-flush-requests.patch

diff --git a/debian/patches/0012-linux-zvols-correctly-detect-flush-requests.patch b/debian/patches/0012-linux-zvols-correctly-detect-flush-requests.patch
new file mode 100644
index 0000000..25159ef
--- /dev/null
+++ b/debian/patches/0012-linux-zvols-correctly-detect-flush-requests.patch
@@ -0,0 +1,63 @@
+From 4482e91446c35d4194be49b715c6bb8a3ad9ba18 Mon Sep 17 00:00:00 2001
+From: Fabian-Gruenbichler <f.gruenbichler@proxmox.com>
+Date: Wed, 12 Mar 2025 22:39:01 +0100
+Subject: [PATCH 12/12] linux: zvols: correctly detect flush requests (#17131)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+since 4.10, bio->bi_opf needs to be checked to determine all kinds of
+flush requests. this was the case prior to the commit referenced below,
+but the order of ifdefs was not the usual one (newest up top), which
+might have caused this to slip through.
+
+this fixes a regression when using zvols as Qemu block devices, but
+might have broken other use cases as well. the symptoms are that all
+sync writes from within a VM configured to use such a virtual block
+devices are ignored and treated as async writes by the host ZFS layer.
+
+this can be verified using fio in sync mode inside the VM, for example
+with
+
+ fio \
+ --filename=/dev/sda --ioengine=libaio --loops=1 --size=10G \
+ --time_based --runtime=60 --group_reporting --stonewall --name=cc1 \
+ --description="CC1" --rw=write --bs=4k --direct=1 --iodepth=1 \
+ --numjobs=1 --sync=1
+
+which shows an IOPS number way above what the physical device underneath
+supports, with "zpool iostat -r 1" on the hypervisor side showing no
+sync IO occuring during the benchmark.
+
+with the regression fixed, both fio inside the VM and the IO stats on
+the host show the expected numbers.
+
+Fixes: 846b5985192467acabf5484ae610b4b37b7f8162
+"config: remove HAVE_REQ_OP_* and HAVE_REQ_*"
+
+Signed-off-by: Fabian-Gruenbichler <f.gruenbichler@proxmox.com>
+Co-authored-by: Alexander Motin <mav@FreeBSD.org>
+Reviewed-by: Alexander Motin <mav@FreeBSD.org>
+Reviewed-by: Tony Hutter <hutter2@llnl.gov>
+(cherry picked from commit 41823a0ede88377c39ad218ddd1e60776ea5f466)
+Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
+---
+ include/os/linux/kernel/linux/blkdev_compat.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/os/linux/kernel/linux/blkdev_compat.h b/include/os/linux/kernel/linux/blkdev_compat.h
+index c0d377074..26e7b0b2a 100644
+--- a/include/os/linux/kernel/linux/blkdev_compat.h
++++ b/include/os/linux/kernel/linux/blkdev_compat.h
+@@ -356,7 +356,7 @@ bio_set_flush(struct bio *bio)
+ static inline boolean_t
+ bio_is_flush(struct bio *bio)
+ {
+-	return (bio_op(bio) == REQ_OP_FLUSH);
++	return (bio_op(bio) == REQ_OP_FLUSH || op_is_flush(bio->bi_opf));
+ }
+ 
+ /*
+-- 
+2.39.5
+
diff --git a/debian/patches/series b/debian/patches/series
index 229027f..938488c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@
 0009-arc-stat-summary-guard-access-to-freshly-introduced-.patch
 0010-Fix-nfs_truncate_shares-without-etc-exports.d.patch
 0011-zpool-status-tighten-bounds-for-noalloc-stat-availab.patch
+0012-linux-zvols-correctly-detect-flush-requests.patch
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

             reply	other threads:[~2025-03-13 11:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 11:32 Fabian Grünbichler [this message]
2025-03-16 19:23 ` [pve-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250313113214.23456-1-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal