[lxc-devel] [lxd/master] Storage: Switch to threads locking mode and writeback cache mode for VMs on BTRFS
tomponline on Github
lxc-bot at linuxcontainers.org
Wed Sep 16 10:25:48 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 579 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200916/961601b2/attachment.bin>
-------------- next part --------------
From d67a7eb0e233148cf12d17138f786e0df41a226f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Wed, 16 Sep 2020 11:23:41 +0100
Subject: [PATCH] lxd/instance/drivers/driver/qemu: Switch to threads locking
mode and writeback cache mode for BTRFS
When taking snapshots of running VMs on BTRFS backed filesystems this was causing issues when doing BTRFS volume send/recv.
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/instance/drivers/driver_qemu.go | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index c3b3d80d35..00c9847198 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -2041,11 +2041,14 @@ func (vm *qemu) addDriveConfig(sb *strings.Builder, bootIndexes map[string]int,
return errors.Wrapf(err, "Failed detecting filesystem type of %q", driveConf.DevPath)
}
- // If FS is ZFS, avoid using direct I/O and use host page cache only.
- if fsType == "zfs" {
+ // If backing FS is ZFS or BTRFS, avoid using direct I/O and use host page cache only.
+ // We've seen ZFS hangs and BTRFS checksum issues when using direct I/O on image files.
+ if fsType == "zfs" || fsType == "btrfs" {
if driveConf.FSType != "iso9660" {
- logger.Warnf("Using writeback cache I/O with %s", driveConf.DevPath)
+ // Only warn about using writeback cache if the drive image is writable.
+ logger.Warnf("Using writeback cache I/O with %q as backing filesystem is %q", driveConf.DevPath, fsType)
}
+
aioMode = "threads"
cacheMode = "writeback" // Use host cache, with neither O_DSYNC nor O_DIRECT semantics.
}
More information about the lxc-devel
mailing list