1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvchange: allow a transiently failed RaidLV to be refreshed

In case any SubLV of a RaidLV transiently fails, it needs
two "lvchange --refresh RaidLV" runs to get it to fully
operational mode again.  Reason being, that lvm reloads all
targets for the RaidLV tree but doesn't resume the SubLVs
until after the whole tree has been reloaded in the first
refresh run.  Thus the live mapping table of the SubLVs
still point to an "error" mapping and the dm-raid target
can't retrieve any superblock from the MetaLV(s) in processing
the constructor during this preload thus not discovering the
again accessible SubLVs.  In the second run, the SubLV targets
map proper (meta)data, hence the constructor discovers those
fine now.

Solve by resuming the SubLVs of the RaidLV before
preloading the respective top-level RaidLV target.

Resolves: rhbz1399844
This commit is contained in:
Heinz Mauelshagen 2016-11-30 22:56:37 +01:00
parent 58f4d98af1
commit 0b8bf73a63

View File

@ -1382,7 +1382,7 @@ int replace_lv_with_error_segment(struct logical_volume *lv)
return 1;
}
int lv_refresh_suspend_resume(const struct logical_volume *lv)
static int _lv_refresh_suspend_resume(const struct logical_volume *lv)
{
struct cmd_context *cmd = lv->vg->cmd;
int r = 1;
@ -1407,6 +1407,33 @@ int lv_refresh_suspend_resume(const struct logical_volume *lv)
return r;
}
int lv_refresh_suspend_resume(const struct logical_volume *lv)
{
/*
* FIXME:
*
* in case of RAID, refresh the SubLVs before
* refreshing the top-level one in order to cope
* with transient failures of SubLVs.
*/
if (lv_is_raid(lv)) {
uint32_t s;
struct lv_segment *seg = first_seg(lv);
for (s = 0; s < seg->area_count; s++) {
if (seg_type(seg, s) == AREA_LV &&
!_lv_refresh_suspend_resume(seg_lv(seg, s)))
return 0;
if (seg->meta_areas &&
seg_metatype(seg, s) == AREA_LV &&
!_lv_refresh_suspend_resume(seg_metalv(seg, s)))
return 0;
}
}
return _lv_refresh_suspend_resume(lv);
}
/*
* Remove given number of extents from LV.
*/