Skip to contentSkip to conversation

main - raidintegrity: allow writecache and cache

PATCH David Teigland 1 participant 1 message Apr 5, 2023

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=390ff5be2fd9dda47f2bfd2db96de64acc925002
Commit:        390ff5be2fd9dda47f2bfd2db96de64acc925002
Parent:        ebbc3f7ab31e8026499bddd93cde4db4921d2132
Author:        David Teigland <[email protected]>
AuthorDate:    Fri Mar 17 16:39:48 2023 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Wed Apr 5 14:24:07 2023 -0500

raidintegrity: allow writecache and cache

Allow writecache|cache over raid+integrity LV.

---
 lib/metadata/snapshot_manip.c   |   9 +
 test/shell/integrity-caching.sh | 561 ++++++++++++++++++++++++++++++++++++++++
 tools/command-lines.in          |   5 -
 tools/pvmove.c                  |   8 +
 4 files changed, 578 insertions(+), 5 deletions(-)
lib/metadata/snapshot_manip.c +9 -0
index 99eb9c30d..822b8da77 100644
@@ -391,6 +391,14 @@ int validate_snapshot_origin(const struct logical_volume *origin_lv)
 {
 	const char *err = NULL; /* For error string */
 
+	if (lv_is_cache(origin_lv) || lv_is_writecache(origin_lv)) {
+		struct logical_volume *lv = seg_lv(first_seg(origin_lv), 0);
+		if (lv_is_raid(lv) && lv_raid_has_integrity(lv)) {
+			err = "raid with integrity";
+			goto out;
+		}
+	}
+
 	if (lv_is_cow(origin_lv))
 		err = "snapshots";
 	else if (lv_is_locked(origin_lv))
@@ -419,6 +427,7 @@ int validate_snapshot_origin(const struct logical_volume *origin_lv)
 		err = "raid with integrity";
 	}
 
+ out:
 	if (err) {
 		log_error("Snapshots of %s are not supported.", err);
 		return 0;
test/shell/integrity-caching.sh new file +561 -0

561 lines not on this page · raw message

tools/command-lines.in +0 -5
index 1cf6bba23..3d311288f 100644
@@ -480,7 +480,6 @@ OO: --cache, OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
 ID: lvconvert_to_cache_with_cachepool
 DESC: Attach a cache pool to an LV, converts the LV to type cache.
 RULE: all and lv_is_visible
-RULE: all not lv_is_raid_with_integrity
 RULE: --poolmetadata not --readahead --stripesize --stripes_long
 
 # alternate form of lvconvert --type cache
@@ -489,7 +488,6 @@ OO: OO_LVCONVERT_CACHE, OO_LVCONVERT_POOL, OO_LVCONVERT
 ID: lvconvert_to_cache_with_cachepool
 DESC: Attach a cache pool to an LV.
 RULE: all and lv_is_visible
-RULE: all not lv_is_raid_with_integrity
 RULE: --poolmetadata not --readahead --stripesize --stripes_long
 FLAGS: SECONDARY_SYNTAX
 AUTOTYPE: cache
@@ -501,7 +499,6 @@ OO: OO_LVCONVERT, --cachesettings String
 ID: lvconvert_to_writecache
 DESC: Attach a writecache to an LV, converts the LV to type writecache.
 RULE: all and lv_is_visible
-RULE: all not lv_is_raid_with_integrity
 
 ---
 
@@ -510,7 +507,6 @@ OO: --cache, OO_LVCONVERT_CACHE, OO_LVCONVERT, --poolmetadatasize SizeMB, --chun
 ID: lvconvert_to_cache_with_cachevol
 DESC: Attach a cache to an LV, converts the LV to type cache.
 RULE: all and lv_is_visible
-RULE: all not lv_is_raid_with_integrity
 
 # alternate form of lvconvert --type cache
 lvconvert --cache --cachevol LV LV_linear_striped_raid_thinpool
@@ -518,7 +514,6 @@ OO: OO_LVCONVERT_CACHE, OO_LVCONVERT, --poolmetadatasize SizeMB, --chunksize Siz
 ID: lvconvert_to_cache_with_cachevol
 DESC: Attach a cache to an LV, converts the LV to type cache.
 RULE: all and lv_is_visible
-RULE: all not lv_is_raid_with_integrity
 FLAGS: SECONDARY_SYNTAX
 
 ---
tools/pvmove.c +8 -0
index ed92f3ce4..ebffe9acd 100644
@@ -645,6 +645,14 @@ static int _pvmove_setup_single(struct cmd_context *cmd,
 			log_error("pvmove not allowed on raid LV with integrity.");
 			return ECMD_FAILED;
 		}
+
+		if (lv_is_cache(lv) || lv_is_writecache(lv)) {
+			struct logical_volume *lv_orig = seg_lv(first_seg(lv), 0);
+			if (lv_is_raid(lv_orig) && lv_raid_has_integrity(lv_orig)) {
+				log_error("pvmove not allowed on raid LV with integrity.");
+				return ECMD_FAILED;
+			}
+		}
 	}
 
 	/*