From 8ff37c68d2ab2754577ebe6e473179e84a158414 Mon Sep 17 00:00:00 2001 From: Fabian-Gruenbichler Date: Wed, 12 Mar 2025 22:39:01 +0100 Subject: [PATCH] linux: zvols: correctly detect flush requests 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 Co-authored-by: Alexander Motin Reviewed-by: Alexander Motin Reviewed-by: Tony Hutter Closes #17131 (cherry picked from commit 41823a0ede88377c39ad218ddd1e60776ea5f466) --- 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)); } /*