1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 01:55:10 +03:00

lvcreate: remove RaidLV on creation failure

In case a newly created RaidLV is blacklisted using config
\"activation { volume list = [ ... ] }\" (i.e. its SubLVs stay inactive),
the metadata SubLVs can't get wiped thus failing the creation.

As a result, the RaidLV together with its SubLVs
is left behind in an inconsistent state.

Fix by removing the RaidLV and provide a hint about volume_list reasoning.

Resolves: rhbz1161347
This commit is contained in:
Heinz Mauelshagen 2018-03-16 15:47:12 +01:00
parent 9553dc7761
commit d68d71013f
2 changed files with 10 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
Remove RaidLV on creation failure when rmeta devices can't be activated.
Add prioritized_section() to restore cookie boundaries (2.02.177).
Enhance error messages when read error happens.
Enhance mirror log initialization for old mirror target.

View File

@ -4100,9 +4100,16 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah,
str_list_wipe(&meta_lv->tags);
}
if (fail)
if (fail) {
/* Fail, after trying to deactivate all we could */
struct volume_group *vg = lv->vg;
if (!lv_remove(lv))
log_error("Failed to remove LV");
else if (!vg_write(vg) || !vg_commit(vg))
log_error("Failed to commit VG %s", vg->name);
return_0;
}
}
for (s = 0; s < seg->area_count; s++)
@ -7155,7 +7162,7 @@ int wipe_lv(struct logical_volume *lv, struct wipe_params wp)
}
if (!lv_is_active_locally(lv)) {
log_error("Volume \"%s/%s\" is not active locally.",
log_error("Volume \"%s/%s\" is not active locally (volume_list activation filter?).",
lv->vg->name, lv->name);
return 0;
}