master - lvconvert: fix (automatic) raid repair regression
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5d455b28fce16fce20f33279fe3b1b682c57e619 Commit: 5d455b28fce16fce20f33279fe3b1b682c57e619 Parent: 78e0fdb6182e8cae26998510760caf7afe237c39 Author: Heinz Mauelshagen <[email protected]> AuthorDate: Wed Sep 21 00:38:38 2016 +0200 Committer: Heinz Mauelshagen <[email protected]> CommitterDate: Wed Sep 21 00:39:29 2016 +0200
lvconvert: fix (automatic) raid repair regression
The dm-raid target now rejects device rebuild requests during ongoing resynchronization thus causing 'lvconvert --repair ...' to fail with a kernel error message. This regresses with respect to failing automatic repair via the dmeventd RAID plugin in case raid_fault_policy="allocate" is configured in lvm.conf as well.
Previously allowing such repair request required cancelling the resynchronization of any still accessible DataLVs, hence reasoning potential data loss.
Patch allows the resynchronization of still accessible DataLVs to finish up by rejecting any 'lvconvert --repair ...'.
It enhances the dmeventd RAID plugin to be able to automatically repair by postponing the repair after synchronization ended.
More tests are added to lvconvert-rebuild-raid.sh to cover single and multiple DataLV failure cases for the different RAID levels.
- resolves: rhbz1371717
--- WHATS_NEW | 1 + daemons/dmeventd/plugins/raid/dmeventd_raid.c | 42 ++++++++-- lib/metadata/lv.c | 6 -- lib/metadata/raid_manip.c | 2 +- test/shell/lvconvert-repair-raid.sh | 104 +++++++++++++++++++++++- tools/lvconvert.c | 18 ---- 6 files changed, 134 insertions(+), 39 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.166 - ===================================== + Fix lvconvert --repair regression Fix reported origin lv field for cache volumes. (2.02.133) Always specify snapshot cow LV for monitoring not internal LV. (2.02.165) Fix lvchange --discard|--zero for active thin-pool.
daemons/dmeventd/plugins/raid/dmeventd_raid.c +33 -9
87 lines not on this page · raw message
lib/metadata/lv.c +0 -6
@@ -1018,12 +1018,6 @@ int lv_raid_image_in_sync(const struct logical_volume *lv)return 0 ; } -if (!lv_raid_percent (raid_seg->lv, &percent)) - return_0; - -if (percent ==DM_PERCENT_100 ) -return 1 ; -/* Find out which sub-LV this is. */ for (s =0 ; s < raid_seg->area_count; s++)if (seg_lv (raid_seg, s) == lv)
lib/metadata/raid_manip.c +1 -1
@@ -3658,7 +3658,7 @@ static int _lv_raid_rebuild_or_replace(struct logical_volume *lv,return 0 ; } -if (!mirror_in_sync () && !_raid_in_sync (lv)) { +if (!_raid_in_sync (lv)) {log_error ("Unable to replace devices in %s/%s while it is" " not in-sync." , lv->vg->name, lv->name);return 0 ;
test/shell/lvconvert-repair-raid.sh +99 -5
126 lines not on this page · raw message
tools/lvconvert.c +0 -18
@@ -1974,24 +1974,6 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *lreturn 0 ; } -if (!lv_raid_percent (lv, &sync_percent)) { -log_error ("Unable to determine sync status of %s." , -display_lvname (lv)); -return 0 ; - } - -if (sync_percent !=DM_PERCENT_100 ) { -log_warn ("WARNING: %s is not in-sync." ,display_lvname (lv)); -log_warn ("WARNING: Portions of the array may be unrecoverable." ); - -/* -* The kernel will not allow a device to be replaced -* in an array that is not in-sync unless we override -* by forcing the array to be considered "in-sync". -*/ -init_mirror_in_sync (1 ); - } -_lvconvert_raid_repair_ask (cmd, lp, &replace);if (replace) {