LVM2 ./WHATS_NEW lib/metadata/mirror.c
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: jbrassow at sourceware.org 2011-09-01 19:22:11
Modified files:
. : WHATS_NEW
lib/metadata : mirror.c
Log message:
Fix for bug 732142: Unsafe table load during mirror image split
There was a bad sequence:
*) Make changes to LV layout to split images (e.g. 4-way -> 2-way/2-way)
1) vg_write, suspend_lv(original_mirror), vg_commit
2) activate_lv(newly_split_lv)
3) resume_lv(original_mirror)
Step #2 is not allowed. However, without it, the resume of the original mirror will also resume its former sub-LVs - making it impossible to activate the newly split LV due to the changes in layering, pointers, and names that had already been made. Additionally, the resume or the original brings the sub-lv's online with names that differ from the metadata on disk - also a no-no. Thus, the split must be done in stages such that the active LVs always reflect what is in the committed LVM metadata.
First, alter the original mirror by releasing the images. The images are made visible and independent as an intermediate stage. (This way, we can have consistency between LVM metadata and active LVs.) The second stage collects the recently split LVs, deactivates them, forms them into a mirror if necessary, and then activates them. It is a bit of a circuitous method, but it is the only way to split a mirror from a mirror and obey these general rules:
1) Never [de]activate sub-lvs when the top-level LV is suspended
2) Avoid having active LVs that differ from the description in the LVM metadata
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2088&r2=1.2089
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.159&r2=1.160
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.89 - ================================== + Fix unsafe table load when splitting off smaller mirror from a larger one. Use size_t return type for text_vg_export_raw() and export_vg_to_buffer(). Add configure --enable-lvmetad for building the (experimental) LVMetaD. Fix resource leak when strdup fails in _get_device_status() (2.02.85).
lib/metadata/mirror.c +114 -70
235 lines not on this page · raw message