From 1852122088bab55a30774e066c2087aa75fa406389e08403a4f9d89caac2242e Mon Sep 17 00:00:00 2001 From: Gang He Date: Thu, 28 May 2020 00:26:20 +0000 Subject: [PATCH] Accepting request 809544 from home:hmzhao:branches:openSUSE:Factory - removing LVM cache with cache volume does not remove the cache volume (bsc#1171907) + bug-1171907-lvremove-remove-attached-cachevol-with-removed-LV.patch OBS-URL: https://build.opensuse.org/request/show/809544 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=273 --- ...ve-attached-cachevol-with-removed-LV.patch | 41 +++++++++++++++++++ lvm2.changes | 6 +++ lvm2.spec | 2 + 3 files changed, 49 insertions(+) create mode 100644 bug-1171907-lvremove-remove-attached-cachevol-with-removed-LV.patch diff --git a/bug-1171907-lvremove-remove-attached-cachevol-with-removed-LV.patch b/bug-1171907-lvremove-remove-attached-cachevol-with-removed-LV.patch new file mode 100644 index 0000000..8b56a0e --- /dev/null +++ b/bug-1171907-lvremove-remove-attached-cachevol-with-removed-LV.patch @@ -0,0 +1,41 @@ +change this patch +from: if (!lv_detach_cache_vol(lv, 0)) { +to : if (!lv_detach_cache_vol(lv)) { +by heming.zhao@suse.com + +--- +From 56aadd7fe2a1d24043ea9d06543c29317ac1cc58 Mon Sep 17 00:00:00 2001 +From: David Teigland +Date: Tue, 24 Sep 2019 13:46:40 -0500 +Subject: [PATCH] lvremove: remove attached cachevol with removed LV + +When an LV is removed that has an attached cachevol, +also remove the cachevol LV. +--- + lib/metadata/lv_manip.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c +index 79e3d15..f404555 100644 +--- a/lib/metadata/lv_manip.c ++++ b/lib/metadata/lv_manip.c +@@ -6283,10 +6283,16 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, + return_0; + + if (lv_is_cache(lv) && lv_is_cache_vol(first_seg(lv)->pool_lv)) { ++ struct logical_volume *cachevol_lv = first_seg(lv)->pool_lv; ++ + if (!lv_detach_cache_vol(lv)) { + log_error("Failed to detach cache from %s", display_lvname(lv)); + return 0; + } ++ if (!lv_remove_single(cmd, cachevol_lv, force, suppress_remove_message)) { ++ log_error("Failed to remove cachevol %s.", display_lvname(cachevol_lv)); ++ return 0; ++ } + } + + /* FIXME Ensure not referred to by another existing LVs */ +-- +1.8.3.1 + diff --git a/lvm2.changes b/lvm2.changes index 0833c9e..99007f4 100644 --- a/lvm2.changes +++ b/lvm2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed May 27 13:00:58 UTC 2020 - heming.zhao@suse.com + +- removing LVM cache with cache volume does not remove the cache volume (bsc#1171907) + + bug-1171907-lvremove-remove-attached-cachevol-with-removed-LV.patch + ------------------------------------------------------------------- Wed May 13 03:45:38 UTC 2020 - heming.zhao@suse.com diff --git a/lvm2.spec b/lvm2.spec index 341c5d1..cc82ea2 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -93,6 +93,7 @@ Patch0035: bug-1150021_04-bcache-add-unit-test.patch Patch0036: bug-1150021_05-bcache-bcache_invalidate_fd-only-remove-prefixes-on.patch Patch0037: bug-1150021_06-fix-dev_unset_last_byte-after-write-error.patch Patch0038: bug-1157736-add-suggestion-message-for-mirror-LVs.patch +Patch0039: bug-1171907-lvremove-remove-attached-cachevol-with-removed-LV.patch # SUSE patches: 1000+ for LVM # Never upstream Patch1001: cmirrord_remove_date_time_from_compilation.patch @@ -185,6 +186,7 @@ Volume Manager. %patch0036 -p1 %patch0037 -p1 %patch0038 -p1 +%patch0039 -p1 %patch1001 -p1 %patch1002 -p1 %patch1003 -p1