From 116bcb3ea4c3e4b030180757fb5be149af1fda07 Mon Sep 17 00:00:00 2001 From: Jonathan Brassow Date: Fri, 14 Sep 2012 16:12:52 -0500 Subject: [PATCH] RAID1: Like mirrors, do not allow adding images to LV created w/ --nosync Mirrors do not allow upconverting if the LV has been created with --nosync. We will enforce the same rule for RAID1. It isn't hugely critical, since the portions that have been written will be copied over to the new device identically from either of the existing images. However, the unwritten sections may be different, causing the added image to be a hybrid of the existing images. Also, we are disallowing the addition of new images to a RAID1 LV that has not completed the initial sync. This may be different from mirroring, but that is due to the fact that the 'mirror' segment type "stacks" when adding a new image and RAID1 does not. RAID1 will rebuild a newly added image "inline" from the existant images, so they should be in-sync. --- WHATS_NEW | 1 + lib/metadata/raid_manip.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 2b897e89d..6ef9d5ca3 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.98 - ================================= + Disallow RAID1 upconvert if the LV was created with --nosync. Depend on systemd-udev-settle in units generated by activation generator. Fix vgchange -aay to activate proper logical volumes. Properly handle 'resync' of RAID LVs. diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 4eced6fbd..131f9d236 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -639,6 +639,18 @@ static int _raid_add_images(struct logical_volume *lv, struct lv_list *lvl; struct lv_segment_area *new_areas; + if (lv->status & LV_NOTSYNCED) { + log_error("Can't add image to out-of-sync RAID LV:" + " use 'lvchange --resync' first."); + return 0; + } + + if (!_raid_in_sync(lv)) { + log_error("Can't add image to RAID LV that" + " is still initializing."); + return 0; + } + dm_list_init(&meta_lvs); /* For image addition */ dm_list_init(&data_lvs); /* For image addition */