1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

pvmove: don't crash when name is not found

If the device name is not found in our metadata,
we cannot call strdup few lines later with NULL name.

More intersting story goes behind how it happens -
pvmove removal is unfortunatelly 'multi-state' process
and at some point (for now)  we have in lvm2 metadata
LV  pvmove0 as stripe  and mirror image as error.

If such metadata are left - we fail with any further removal.
This commit is contained in:
Zdenek Kabelac 2015-04-03 17:14:50 +02:00
parent c88ffbf9df
commit 4f94669eca

View File

@ -223,6 +223,12 @@ static int _poll_vg(struct cmd_context *cmd, const char *vgname,
if (!name && !parms->aborting) if (!name && !parms->aborting)
continue; continue;
if (!name) {
log_error("Device name for LV %s not found in metadata. "
"(unfinished pvmove mirror removal?)", display_lvname(lv));
goto err;
}
/* FIXME Need to do the activation from _set_up_pvmove here /* FIXME Need to do the activation from _set_up_pvmove here
* if it's not running and we're not aborting. */ * if it's not running and we're not aborting. */
if (!lv_is_active(lv)) { if (!lv_is_active(lv)) {