From a579ba2ac27d9651165e7e997a5ff855dc83c170 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Thu, 28 Jul 2016 18:34:46 +0200 Subject: [PATCH] vgsplit: ea90a3d622 added an unconditional call to lv_is_on_pvs() on any thin snap external origin LV which caused a segfault when none existed as exposed by the vgsplit-thin.sh test. Only call lv_is_on_pvs() if an external origin LV actually exists and correct the related splitting logic. --- tools/vgsplit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/vgsplit.c b/tools/vgsplit.c index fd43650af..93161c17d 100644 --- a/tools/vgsplit.c +++ b/tools/vgsplit.c @@ -331,8 +331,8 @@ static int _move_thins(struct volume_group *vg_from, data_lv = seg_lv(first_seg(seg->pool_lv), 0); /* Ignore, if no allocations on PVs of @vg_to */ - if (!lv_is_on_pvs(data_lv, &vg_to->pvs) && - !lv_is_on_pvs(seg->external_lv, &vg_to->pvs)) + if (!lv_is_on_pvs(data_lv, &vg_to->pvs) || + (seg->external_lv && !lv_is_on_pvs(seg->external_lv, &vg_to->pvs))) continue; if ((_lv_is_in_vg(vg_to, data_lv) || -- 2.43.5