Skip to contentSkip to conversation

master - cache: improve vgremove loop

PATCH Zdenek Kabelac 1 participant 1 message Aug 26, 2019

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c98e34e4d0edbcb2594e93f06183838de0c6e2bc
Commit:        c98e34e4d0edbcb2594e93f06183838de0c6e2bc
Parent:        af0b84ccc850d619eddef5112753731abce099ed
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Mon Aug 26 13:28:00 2019 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Aug 26 15:32:12 2019 +0200

cache: improve vgremove loop

Support internal removal of 'cache origin' volume - which we do not normally expose to a user - however internal processing loops may hit this condition (depending on order of list LVs).

So when this operation is internally requested - we automatically try to remove it's 'holding' LV (cache LV) - which will also remove the origin.

---
 WHATS_NEW               |    1 +
 lib/metadata/lv_manip.c |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
index 0b48e03..cb93bbe 100644
@@ -1,5 +1,6 @@
 Version 2.03.06 - 
 ================================
+  Improve internal removal of cached devices.
   Synchronize with udev when dropping snapshot.
   Add missing device synchronization point before removing pvmove node.
   Correctly set read_ahead for LVs when pvmove is finished.
lib/metadata/lv_manip.c +7 -0
index 6aee947..af3a16f 100644
@@ -6544,6 +6544,13 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
 		return 0;
 	}
 
+	if (lv_is_cache_origin(lv)) {
+		if (!_lv_remove_segs_using_this_lv(cmd, lv, force, level, "cache origin"))
+			return_0;
+		/* Removal of cache LV also removes caching origin */
+		return 1;
+	}
+
 	if (lv_is_external_origin(lv) &&
 	    !_lv_remove_segs_using_this_lv(cmd, lv, force, level, "external origin"))
 		return_0;