Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/raid_manip.c tes ...

PATCH [email protected] 1 participant 1 message Mar 15, 2012

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow at sourceware.org 2012-03-15 20:00:54

Modified files:

	.              : WHATS_NEW 
	lib/metadata   : raid_manip.c 
	test/shell     : lvconvert-raid.sh 

Log message:
Fix name conflicts that prevent down-converting RAID1 when specifying a device

When down-converting a RAID1 device, it is the last device that is extracted and removed when the user does not specify a particular device. However, when a device is specified (and it is not the last), the device is removed and the remaining sub-LVs are "shifted down" to fill the hole. This cause problems when resuming the LV because if the shifted devices were resumed (and thus renamed) before the sub-LV being extracted, there would be a name conflict. The solution is to resume the extracted sub-LVs first so that they can be properly renamed preventing a possible conflict.

This addresses bug 801967.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2356&r2=1.2357
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/raid_manip.c.diff?cvsroot=lvm2&r1=1.24&r2=1.25
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/shell/lvconvert-raid.sh.diff?cvsroot=lvm2&r1=1.3&r2=1.4

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.96 - 
 ================================
+  Fix name conflicts that prevent down-converting RAID1 when specifying a device
   Improve thin_check option passing and use configured path.
   Add --with-thin-check configure option for path to thin_check.
   Detect lvm binary path in lvmetad udev rules.
lib/metadata/raid_manip.c +13 -1
@@ -1012,8 +1012,20 @@
 	}
 
 	/*
+	 * We resume the extracted sub-LVs first so they are renamed
+	 * and won't conflict with the remaining (possibly shifted)
+	 * sub-LVs.
+	 */
+	dm_list_iterate_items(lvl, &removal_list) {
+		if (!resume_lv(lv->vg->cmd, lvl->lv)) {
+			log_error("Failed to resume extracted LVs");
+			return 0;
+		}
+	}
+
+	/*
 	 * Resume original LV
-	 * This also resumes all other sub-lvs (including the extracted)
+	 * This also resumes all other sub-LVs
 	 */
 	if (!resume_lv(lv->vg->cmd, lv)) {
 		log_error("Failed to resume %s/%s after committing changes",
test/shell/lvconvert-raid.sh +7 -0
@@ -156,6 +156,13 @@
 	done
 done
 done
+
+# 3-way to 2-way convert while specifying devices
+lvcreate --type raid1 -m 2 -l 2 -n $lv1 $vg $dev1 $dev2 $dev3
+wait_for_sync $vg/$lv1
+lvconvert -m1 $vg/$lv1 $dev2
+lvremove -ff $vg
+
 #
 # FIXME: Add tests that specify particular devices to be removed
 #