]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- avoid running 'btrfs qgroup clear-stale' if quota is disabled 988/head
authorArvin Schnell <aschnell@suse.de>
Tue, 4 Feb 2025 09:12:11 +0000 (10:12 +0100)
committerArvin Schnell <aschnell@suse.de>
Tue, 4 Feb 2025 09:12:11 +0000 (10:12 +0100)
client/systemd-helper/systemd-helper.cc
package/snapper.changes

index 557ce842cdef78f50a36287fd7693be740586442..9f4bc5508f8bbec08bdf4d362d2e1fc283f3922c 100644 (file)
@@ -181,16 +181,24 @@ cleanup(ProxySnappers* snappers)
            {
                string general_dir = (subvolume == "/" ? "" : subvolume) + "/" SNAPSHOTS_NAME;
 
-               cout << "Running 'btrfs qgroup clear-stale " << general_dir << "'." << endl;
+               // Workaround for missing 'btrfs quota
+               // status'. /sys/fs/btrfs/<fsid>/qgroups is not available on all
+               // maintained kernels (only since 5.9).
 
-               SystemCmd cmd({ BTRFS_BIN, "qgroup", "clear-stale", general_dir });
-               if (cmd.retcode() != 0)
+               SystemCmd cmd1({ BTRFS_BIN, "qgroup", "show", general_dir });
+               if (cmd1.retcode() == 0)
                {
-                   // This fails more often than not since qgroups of just deleted
-                   // subvolume are busy. So do not set an error code here. Still log the
-                   // failure to help people understand this stuff.
+                   cout << "Running 'btrfs qgroup clear-stale " << general_dir << "'." << endl;
 
-                   cerr << "'btrfs qgroup clear-stale " << general_dir << "' failed." << endl;
+                   SystemCmd cmd2({ BTRFS_BIN, "qgroup", "clear-stale", general_dir });
+                   if (cmd2.retcode() != 0)
+                   {
+                       // This fails more often than not since qgroups of just deleted
+                       // subvolume are busy. So do not set an error code here. Still log the
+                       // failure to help people understand this stuff.
+
+                       cerr << "'btrfs qgroup clear-stale " << general_dir << "' failed." << endl;
+                   }
                }
            }
        }
index 3c63f5aaabe77df3265634dbfdf50f7b41380f3e..1126734ae12b9293813098f7c6c2d38bc3579db1 100644 (file)
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Tue Feb 04 10:10:41 CET 2025 - aschnell@suse.com
+
+- avoid running 'btrfs qgroup clear-stale' if quota is disabled
+  (gh#openSUSE/snapper#987)
+
 -------------------------------------------------------------------
 Fri Jan 17 07:07:43 CET 2025 - aschnell@suse.com