From 8ebf2b061174daec744f9e361fa7ca28eb19ea2e Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 13 Nov 2015 23:38:34 +0100 Subject: [PATCH] debug: lvconvert add missing display_lvname Add missing display_lvname in _lvconvert_merge_thin_snapshot(). Also when we detect missing origin, report Internal error, which would likely be the primary fault here (and avoid dereft of NULL origin as noticed by Coverity). --- tools/lvconvert.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 335f6a441..3cfd915c8 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -2238,8 +2238,8 @@ static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd, struct logical_volume *origin = snap_seg->origin; if (!origin) { - log_error("\"%s\" is not a mergeable logical volume.", - lv->name); + log_error("%s is not a mergeable logical volume.", + display_lvname(lv)); return 0; } @@ -2251,9 +2251,12 @@ static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd, } if (lv_is_external_origin(origin)) { - origin = origin_from_cow(lv); - log_error("%s is read-only external origin %s.", - display_lvname(lv), display_lvname(origin)); + if (!(origin = origin_from_cow(lv))) + log_error(INTERNAL_ERROR "%s is missing origin.", + display_lvname(lv)); + else + log_error("%s is read-only external origin %s.", + display_lvname(lv), display_lvname(origin)); return 0; }