Skip to contentSkip to conversation

main - vdo: resize requires active vdopool volume

PATCH Zdenek Kabelac 1 participant 1 message Jan 16, 2023

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c20f01a0cbb24e8276734a00f26a510cf6daaf21
Commit:        c20f01a0cbb24e8276734a00f26a510cf6daaf21
Parent:        2451bc568feb9b3d0cb4d7c15e3c723f4d0c8cc9
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Sun Jan 15 21:27:57 2023 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Jan 16 12:37:40 2023 +0100

vdo: resize requires active vdopool volume

ATM kernel VDO target does not handle resize of inactive VDO LVs so prevent users corrupting such LVs and require active such LVs.

---
 lib/metadata/lv_manip.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
lib/metadata/lv_manip.c +10 -0
index 305be8578..cb7f26069 100644
@@ -5954,6 +5954,16 @@ static int _lv_resize_check_used(struct logical_volume *lv)
 		return 0;
 	}
 
+	if (lv_is_vdo(lv) && !lv_is_active(lv)) {
+		log_error("Cannot resize inactive VDO logical volume %s.", display_lvname(lv));
+		return 0;
+	}
+
+	if (lv_is_vdo_pool(lv) && !lv_is_active(lv_lock_holder(lv))) {
+		log_error("Cannot resize inactive VDO POOL volume %s.", display_lvname(lv));
+		return 0;
+	}
+
 	if (lv_is_external_origin(lv)) {
 		/*
 		 * Since external-origin can be activated read-only,