Skip to contentSkip to conversation

main - cache: fix snapshot of cache with cachevol

PATCH David Teigland 1 participant 1 message Apr 10, 2023

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=317071ec53c2f6e338c53a8964fdbb61dc3e8b57
Commit:        317071ec53c2f6e338c53a8964fdbb61dc3e8b57
Parent:        8458ff9ad18c518b774d16358e28a805057e4dc1
Author:        David Teigland <[email protected]>
AuthorDate:    Mon Apr 10 11:41:28 2023 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Mon Apr 10 12:44:22 2023 -0500

cache: fix snapshot of cache with cachevol

Creating a snapshot of a cache LV with a cachevol would fail because cache_check was not being skipped.

---
 lib/activate/dev_manager.c     |   2 +
 test/shell/caching-snapshot.sh | 162 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+)
lib/activate/dev_manager.c +2 -0
index ec642f421..07d58733e 100644
@@ -3694,6 +3694,8 @@ static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
 	if (lv_is_cache(lv) && lv_is_cache_vol(first_seg(lv)->pool_lv) &&
 	    /* Register callback only for layer activation or non-layered cache LV */
 	    (layer || !lv_layer(lv)) &&
+	    /* Register callback when cachevol LV is NOT already active */
+	    !_cached_dm_info(dm->mem, dtree, first_seg(lv)->pool_lv, NULL) &&
 	    !_pool_register_callback(dm, dnode, lv))
 		return_0;
 
test/shell/caching-snapshot.sh new file +162 -0

162 lines not on this page · raw message