diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 63bd1a63b..2b64be0cf 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -5091,6 +5091,7 @@ static int _rename_area_lvs(struct logical_volume *lv, const char *suffix) size_t sz = sizeof("rimage") - 1 + (suffix ? strlen(suffix) : 0) + 1; char *sfx[SLV_COUNT] = { NULL, NULL }; struct lv_segment *seg = first_seg(lv); + const char *lv_name; /* Create _generate_raid_name() suffixes w/ or w/o passed in @suffix */ for (s = 0; s < SLV_COUNT; s++) @@ -5100,10 +5101,12 @@ static int _rename_area_lvs(struct logical_volume *lv, const char *suffix) /* Change names (temporarily) to be able to shift numerical name suffixes */ for (s = 0; s < seg->area_count; s++) { - if (!(seg_lv(seg, s)->name = _generate_raid_name(lv, sfx[0], s))) + if (!(lv_name = _generate_raid_name(lv, sfx[0], s)) || + !lv_set_name(seg_lv(seg, s), lv_name)) return_0; if (seg->meta_areas && - !(seg_metalv(seg, s)->name = _generate_raid_name(lv, sfx[1], s))) + (!(lv_name = _generate_raid_name(lv, sfx[1], s)) || + !lv_set_name(seg_metalv(seg, s), lv_name))) return_0; } diff --git a/lib/metadata/writecache_manip.c b/lib/metadata/writecache_manip.c index f2f1df8ac..ab7fc2c8c 100644 --- a/lib/metadata/writecache_manip.c +++ b/lib/metadata/writecache_manip.c @@ -162,7 +162,8 @@ static void _rename_detached_cvol(struct cmd_context *cmd, struct logical_volume return; } - lv_fast->name = cvol_name_dup; + if (!lv_set_name(lv_fast, cvol_name_dup)) + stack; } static int _lv_detach_writecache_cachevol_inactive(struct logical_volume *lv, int noflush)