summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2014-09-11 22:55:12 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2014-09-12 13:51:31 +0200
commitab7977de7b0c3d4586c40eca0179fbae24bc23ba (patch)
tree3d562e505c707fdd937470b40b952e5072e9c907
parent68981310916114e8659bb7754c5847a178aaea5d (diff)
downloadlvm2-ab7977de7b0c3d4586c40eca0179fbae24bc23ba.tar.gz
cleanup: simplify _extract_image_components
Reorder test - first check for writable flag and then allocate.
-rw-r--r--lib/metadata/raid_manip.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 0c96fd0d6..6883a6805 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -1261,8 +1261,13 @@ int lv_raid_merge(struct logical_volume *image_lv)
struct lv_segment *seg;
struct volume_group *vg = image_lv->vg;
- lv_name = dm_pool_strdup(vg->vgmem, image_lv->name);
- if (!lv_name)
+ if (image_lv->status & LVM_WRITE) {
+ log_error("%s is not read-only - refusing to merge.",
+ display_lvname(image_lv));
+ return 0;
+ }
+
+ if (!(lv_name = dm_pool_strdup(vg->vgmem, image_lv->name)))
return_0;
if (!(p = strstr(lv_name, "_rimage_"))) {
@@ -1272,12 +1277,6 @@ int lv_raid_merge(struct logical_volume *image_lv)
}
*p = '\0'; /* lv_name is now that of top-level RAID */
- if (image_lv->status & LVM_WRITE) {
- log_error("%s/%s is not read-only - refusing to merge",
- vg->name, image_lv->name);
- return 0;
- }
-
if (!(lvl = find_lv_in_vg(vg, lv_name))) {
log_error("Unable to find containing RAID array for %s.",
display_lvname(image_lv));