From: Arvin Schnell Date: Tue, 4 Feb 2025 09:12:11 +0000 (+0100) Subject: - avoid running 'btrfs qgroup clear-stale' if quota is disabled X-Git-Tag: v0.12.2~22^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a22a7389cc1732e39d2a88b2e1c0bfdab519dba8;p=thirdparty%2Fsnapper.git - avoid running 'btrfs qgroup clear-stale' if quota is disabled --- diff --git a/client/systemd-helper/systemd-helper.cc b/client/systemd-helper/systemd-helper.cc index 557ce842..9f4bc550 100644 --- a/client/systemd-helper/systemd-helper.cc +++ b/client/systemd-helper/systemd-helper.cc @@ -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//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; + } } } } diff --git a/package/snapper.changes b/package/snapper.changes index 3c63f5aa..1126734a 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -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