From: Jonathan Brassow Date: Fri, 14 Sep 2012 21:13:19 +0000 (UTC) Subject: master - RAID1: Like mirrors, do not allow adding images to LV created w/ --nosync Message-ID: <20120914211319.91E61A26EF@fedorahosted.org> List-Id: To: lvm-devel@redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=116bcb3ea4c3e4b030180757fb5be149af1fda07 Commit: 116bcb3ea4c3e4b030180757fb5be149af1fda07 Parent: 5cdd7848f46305d3d5744c194d4e2d38b78f0ec7 Author: Jonathan Brassow AuthorDate: Fri Sep 14 16:12:52 2012 -0500 Committer: Jonathan Brassow CommitterDate: Fri Sep 14 16:12:52 2012 -0500 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(+), 0 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 2b897e8..6ef9d5c 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 4eced6f..131f9d2 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 */