From 91fd1c45e124e9df2ac1d375375aa93ab3f5445d Mon Sep 17 00:00:00 2001 From: Sandwich Date: Sun, 6 Sep 2026 05:39:31 +0200 Subject: [PATCH] fix: buffered disk cache so btrfs checksums stay valid --- scripts/setup-vm.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/setup-vm.sh b/scripts/setup-vm.sh index 641d46b..f4a7c86 100755 --- a/scripts/setup-vm.sh +++ b/scripts/setup-vm.sh @@ -637,8 +637,11 @@ if conformant and E["CONVERT"] == "1": if "device='disk'" not in d or ("bus='nvme'" in d and "" in d): return d d = re.sub(r"", r"", d) + # cache='none' is O_DIRECT: on btrfs the guest can change a page while the + # write is in flight, so the stored checksum never matches and later reads + # fail with EIO. Buffered writes hand the filesystem a stable page. d = re.sub(r"", - r"", d) + r"", d) d = re.sub(r"\s*
", "", d) if "" not in d: serial = E["NVME_SERIAL"] if n[0] == 0 else E["NVME_SERIAL"][:-1] + "0123456789ABCDEF"[n[0] % 16]