summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-containers/lxd/files/lxd-5.0.3-btrfs-quota-group-fix.patch')
-rw-r--r--app-containers/lxd/files/lxd-5.0.3-btrfs-quota-group-fix.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/app-containers/lxd/files/lxd-5.0.3-btrfs-quota-group-fix.patch b/app-containers/lxd/files/lxd-5.0.3-btrfs-quota-group-fix.patch
new file mode 100644
index 000000000000..4e993b7e7054
--- /dev/null
+++ b/app-containers/lxd/files/lxd-5.0.3-btrfs-quota-group-fix.patch
@@ -0,0 +1,52 @@
+From e7c852e43c0479060e630adb50342d2552a6cdad Mon Sep 17 00:00:00 2001
+From: Thomas Parrott <thomas.parrott@canonical.com>
+Date: Tue, 7 Feb 2023 10:04:27 +0000
+Subject: [PATCH] lxd/storage/drivers/driver/btrfs/utils: Only check for
+ minimum number of columns in `btrfs qgroup show` command
+
+Previously we expected 4 columns, but in btrfs-progs >= 6.0 this has changed to 5 columns.
+
+E.g. in Jammy btrfs-progs v5.16.2:
+
+```
+sudo btrfs qgroup show /var/lib/lxd/storage-pools/btrfs
+qgroupid rfer excl
+-------- ---- ----
+0/5 16.00KiB 16.00KiB
+0/256 9.66MiB 400.00KiB
+0/257 9.66MiB 392.00KiB
+```
+
+And in Lunar btrfs-progs v6.1.3:
+
+```
+btrfs qgroup show /var/lib/lxd/storage-pools/btrfs
+Qgroupid Referenced Exclusive Path
+-------- ---------- --------- ----
+0/5 16.00KiB 16.00KiB <toplevel>
+0/256 9.63MiB 400.00KiB images/1f81470478d136f0008c856e3a47369e0ac863f0402ce0e31c56dd29e9fdd4d7
+0/257 9.64MiB 404.00KiB containers/c1
+```
+
+Fixes #11210
+
+Signed-off-by: Thomas Parrott <thomas.parrott@canonical.com>
+---
+ lxd/storage/drivers/driver_btrfs_utils.go | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/lxd/storage/drivers/driver_btrfs_utils.go b/lxd/storage/drivers/driver_btrfs_utils.go
+index e1468e4b1a59..722a2de20978 100644
+--- a/lxd/storage/drivers/driver_btrfs_utils.go
++++ b/lxd/storage/drivers/driver_btrfs_utils.go
+@@ -253,7 +253,9 @@ func (d *btrfs) getQGroup(path string) (string, int64, error) {
+ }
+
+ fields := strings.Fields(line)
+- if len(fields) != 4 {
++
++ // The BTRFS tooling changed the number of columns between versions so we only check for minimum.
++ if len(fields) < 3 {
+ continue
+ }
+