fix: buffered disk cache so btrfs checksums stay valid
This commit is contained in:
@@ -637,8 +637,11 @@ if conformant and E["CONVERT"] == "1":
|
|||||||
if "device='disk'" not in d or ("bus='nvme'" in d and "<serial>" in d):
|
if "device='disk'" not in d or ("bus='nvme'" in d and "<serial>" in d):
|
||||||
return d
|
return d
|
||||||
d = re.sub(r"<target dev='([^']*)' bus='(virtio|sata|scsi)'/>", r"<target dev='\1' bus='nvme'/>", d)
|
d = re.sub(r"<target dev='([^']*)' bus='(virtio|sata|scsi)'/>", r"<target dev='\1' bus='nvme'/>", 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"<driver name='qemu' type='([^']*)'[^/]*/>",
|
d = re.sub(r"<driver name='qemu' type='([^']*)'[^/]*/>",
|
||||||
r"<driver name='qemu' type='\1' cache='none' io='native' discard='unmap'/>", d)
|
r"<driver name='qemu' type='\1' cache='writeback' io='threads' discard='unmap'/>", d)
|
||||||
d = re.sub(r"\s*<address type='(pci|drive)'[^/]*/>", "", d)
|
d = re.sub(r"\s*<address type='(pci|drive)'[^/]*/>", "", d)
|
||||||
if "<serial>" not in d:
|
if "<serial>" not in d:
|
||||||
serial = E["NVME_SERIAL"] if n[0] == 0 else E["NVME_SERIAL"][:-1] + "0123456789ABCDEF"[n[0] % 16]
|
serial = E["NVME_SERIAL"] if n[0] == 0 else E["NVME_SERIAL"][:-1] + "0123456789ABCDEF"[n[0] % 16]
|
||||||
@@ -824,7 +827,7 @@ if [ "$PROFILE" = full ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e /usr/lib/udev/rules.d/99-vfio-native-vnet-offload.rules ] && [ ! -e /etc/udev/rules.d/99-vfio-native-vnet-offload.rules ]; then
|
if [ ! -e /usr/lib/udev/rules.d/99-vfio-native-vnet-offload.rules ] && [ ! -e /etc/udev/rules.d/99-vfio-native-vnet-offload.rules ]; then
|
||||||
echo "NOTE: the e1000e offload udev rule is not installed. SSH into the guest will fail with"
|
echo "NOTE: the NIC offload udev rule is not installed. SSH into the guest will fail with"
|
||||||
echo " 'Corrupted MAC on input' until it is:"
|
echo " 'Corrupted MAC on input' until it is:"
|
||||||
echo " sudo install -Dm644 $SELF/scripts/99-vfio-native-vnet-offload.rules /etc/udev/rules.d/ && sudo udevadm control --reload-rules"
|
echo " sudo install -Dm644 $SELF/scripts/99-vfio-native-vnet-offload.rules /etc/udev/rules.d/ && sudo udevadm control --reload-rules"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user