]> sourceware.org Git - lvm2.git/commitdiff
activation: use existing LV as best effort
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 9 Mar 2021 17:23:42 +0000 (18:23 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 10 Mar 2021 00:29:06 +0000 (01:29 +0100)
Returning NULL for lv_committed is basically instant crash,
so instead try with passed LV instead.
It shouldn't matter as this is internall error path anyway,
but coverity should be happier.

lib/metadata/metadata.c

index f82ada8be359761d9d92285de6c9cf50c85bd484..71e59207d6f3a8bea7ea6199bb63ce8016edaf6f 100644 (file)
@@ -4335,7 +4335,7 @@ char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tagsl)
 const struct logical_volume *lv_committed(const struct logical_volume *lv)
 {
        struct volume_group *vg;
-       struct logical_volume *found_lv;
+       const struct logical_volume *found_lv;
 
        if (!lv)
                return NULL;
@@ -4348,7 +4348,7 @@ const struct logical_volume *lv_committed(const struct logical_volume *lv)
        if (!(found_lv = find_lv_in_vg_by_lvid(vg, &lv->lvid))) {
                log_error(INTERNAL_ERROR "LV %s (UUID %s) not found in committed metadata.",
                          display_lvname(lv), lv->lvid.s);
-               return NULL;
+               found_lv = lv; /* Use uncommitted LV as best effort */
        }
 
        return found_lv;
This page took 0.040774 seconds and 5 git commands to generate.