The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7876

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
When taking snapshots of running VMs on BTRFS backed filesystems this was causing issues when doing BTRFS volume send/recv.

See https://discuss.linuxcontainers.org/t/running-virtual-machines-with-lxd-4-0/7519/98

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From d67a7eb0e233148cf12d17138f786e0df41a226f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@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.parr...@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.
                }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to