[lvm-devel] [PATCH] Fix vgchange for sparse devices

Mikulas Patocka mpatocka at redhat.com
Tue Oct 25 13:03:40 UTC 2011


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.

Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>

---
 tools/vgchange.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: LVM2.2.02.85/tools/vgchange.c
===================================================================
--- LVM2.2.02.85.orig/tools/vgchange.c	2011-05-19 17:41:17.000000000 +0200
+++ LVM2.2.02.85/tools/vgchange.c	2011-05-19 18:32:00.000000000 +0200
@@ -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;




More information about the lvm-devel mailing list