1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

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.
This commit is contained in:
Jonathan Brassow 2012-09-14 16:12:52 -05:00
parent 5cdd7848f4
commit 116bcb3ea4
2 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.98 - 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. Depend on systemd-udev-settle in units generated by activation generator.
Fix vgchange -aay to activate proper logical volumes. Fix vgchange -aay to activate proper logical volumes.
Properly handle 'resync' of RAID LVs. Properly handle 'resync' of RAID LVs.

View File

@ -639,6 +639,18 @@ static int _raid_add_images(struct logical_volume *lv,
struct lv_list *lvl; struct lv_list *lvl;
struct lv_segment_area *new_areas; 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(&meta_lvs); /* For image addition */
dm_list_init(&data_lvs); /* For image addition */ dm_list_init(&data_lvs); /* For image addition */