Skip to contentSkip to conversation

Fix vgchange for sparse devices

PATCH New Mikulas Patocka 2 participants 2 messages Oct 25, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix vgchange for sparse devices

Fix vgchange for sparse devices

If we create a sparse snapshot volume with "lvcreate --virtualsize", the volume is not activated or deactivated with vgchange.

This patch fixes it so that vgchange activates and deactivates such volumes.

---
 tools/vgchange.c |    4 ++++
 1 file changed, 4 insertions(+)
tools/vgchange.c +4 -0
Index: LVM2.2.02.85/tools/vgchange.c
===================================================================
@@ -96,6 +96,10 @@ static int _activate_lvs_in_vg(struct cm
 		if (!lv_is_visible(lv))
 			continue;
 
+		/* If LV is sparse, activate origin instead */
+		if (lv_is_cow(lv) && lv_is_virtual_origin(origin_from_cow(lv)))
+			lv = origin_from_cow(lv);
+
 		/* Only request activation of snapshot origin devices */
 		if ((lv->status & SNAPSHOT) || lv_is_cow(lv))
 			continue;
#1 lore raw

PATCH 1/1 Fix vgchange for sparse devices

Quoted 4 lines · Mikulas Patocka

Fix vgchange for sparse devices

If we create a sparse snapshot volume with "lvcreate --virtualsize", the volume is not activated or deactivated with vgchange.

this is already in tree btw.

But there are several problems with virtual origins because it was never properly implemented.
https://bugzilla.redhat.com/show_bug.cgi?id=733522
https://bugzilla.redhat.com/show_bug.cgi?id=738435

Milan