summaryrefslogtreecommitdiffstats
path: root/lib/metadata/raid_manip.c
diff options
context:
space:
mode:
authorJonathan Earl Brassow <jbrassow@redhat.com>2012-03-15 20:00:54 +0000
committerJonathan Earl Brassow <jbrassow@redhat.com>2012-03-15 20:00:54 +0000
commitdc7b1640edea796ff236be8594e5278383474c53 (patch)
treec5af0e4cce20bf3783905109554e2e236db42bf4 /lib/metadata/raid_manip.c
parent08e846e3d9103156eb3458e6731f978415a934b0 (diff)
downloadlvm2-dc7b1640edea796ff236be8594e5278383474c53.tar.gz
lvm2-dc7b1640edea796ff236be8594e5278383474c53.tar.xz
lvm2-dc7b1640edea796ff236be8594e5278383474c53.zip
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.
Diffstat (limited to 'lib/metadata/raid_manip.c')
-rw-r--r--lib/metadata/raid_manip.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index a4a6a40d..ffaab277 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1012,8 +1012,20 @@ static int _raid_remove_images(struct logical_volume *lv,
}
/*
+ * 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",