From: Arvin Schnell Date: Wed, 6 Apr 2016 13:25:07 +0000 (+0200) Subject: - handle case when qgroup cannot be destroy X-Git-Tag: v0.3.3~12^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4bf81db37532e74ba0ae3a600abc2e0168362f9d;p=thirdparty%2Fsnapper.git - handle case when qgroup cannot be destroy --- diff --git a/snapper/Btrfs.cc b/snapper/Btrfs.cc index 52291604..8414b723 100644 --- a/snapper/Btrfs.cc +++ b/snapper/Btrfs.cc @@ -381,14 +381,24 @@ namespace snapper #ifdef HAVE_LIBBTRFS deleted_subvolids.push_back(subvolid); +#endif #ifdef ENABLE_BTRFS_QUOTA - // see https://bugzilla.suse.com/show_bug.cgi?id=972511 - SDir subvolume_dir = openSubvolumeDir(); - if (qgroup != no_qgroup) - qgroup_remove(subvolume_dir.fd(), calc_qgroup(0, subvolid), qgroup); - qgroup_destroy(subvolume_dir.fd(), calc_qgroup(0, subvolid)); -#endif + + // workaround for the kernel not deleting the qgroup of a + // subvolume when deleting the subvolume, see + // https://bugzilla.suse.com/show_bug.cgi?id=972511 + + try + { + SDir subvolume_dir = openSubvolumeDir(); + qgroup_destroy(subvolume_dir.fd(), calc_qgroup(0, subvolid)); + } + catch (const runtime_error& e) + { + // Ignore that the qgroup could not be destroyed. Should not + // cause problems except of having unused qgroups. + } #endif }