From cbcbb677313aa8a4116bcfd13ceccef05fb1f9a9 Mon Sep 17 00:00:00 2001 From: Jonathan Brassow Date: Wed, 10 Apr 2013 16:47:04 -0500 Subject: [PATCH] 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. --- tools/lvconvert.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 318ac9b93..7b4bb6e3e 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -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 "