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

mirror: Fix overly-concerning warning on mirror up-convert failure.

Attempting to up-convert an inactive mirror when there is insufficient
space leads to the following message:
  Unable to allocate extents for mirror(s).
  ABORTING: Failed to remove temporary mirror layer inactive_mimagetmp_3.
  Manual cleanup with vgcfgrestore and dmsetup may be required.
This is caused by a failure to execute the 'deactivate_lv' function in
the error condition.  The deactivate returns an error because the LV is
already inactive.  This patch checks if the LV is activate and calls
deactivate_lv only if it is.  This allows the error cleanup code to work
properly in this condition.

It wasn't that big of a deal anyway, since there was no previous vg_commit
that needed to be reverted.  IOW, no harm was done if the allocation failed.
The message was scary and useless.
This commit is contained in:
Jonathan Brassow 2013-04-10 16:47:04 -05:00
parent 95d28735ea
commit cbcbb67731

View File

@ -1303,7 +1303,8 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
MIRROR_BY_LV)) {
layer_lv = seg_lv(first_seg(lv), 0);
if (!remove_layer_from_lv(lv, layer_lv) ||
!deactivate_lv(cmd, layer_lv) ||
(lv_is_active(layer_lv) &&
!deactivate_lv(cmd, layer_lv)) ||
!lv_remove(layer_lv) || !vg_write(lv->vg) ||
!vg_commit(lv->vg)) {
log_error("ABORTING: Failed to remove "