]> sourceware.org Git - lvm2.git/commitdiff
Fix name conflicts that prevent down-converting RAID1 when specifying a device
authorJonathan Earl Brassow <jbrassow@redhat.com>
Thu, 15 Mar 2012 20:00:54 +0000 (20:00 +0000)
committerJonathan Earl Brassow <jbrassow@redhat.com>
Thu, 15 Mar 2012 20:00:54 +0000 (20:00 +0000)
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.

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

index f04ebc3a8e757da4bf59a005e5d0d7dbf84cceb8..d4b8b2bbdb29a32292fe18f7d9fe6a869d570652 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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.
index a4a6a40d9b2da4e37fb09216e36c0514ab4bc832..ffaab277840390cf99f2e4778056f559783f8730 100644 (file)
@@ -1011,9 +1011,21 @@ static int _raid_remove_images(struct logical_volume *lv,
                return 0;
        }
 
+       /*
+        * 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",
index 66a7a249b77a50ac123ce8bfe4999629008f70f7..72b94e89936507f56ce3aee784ea7d28ff7d8665 100644 (file)
@@ -156,6 +156,13 @@ for i in 1 2 3 4; do
        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
 #
This page took 0.041806 seconds and 5 git commands to generate.