diff options
Diffstat (limited to 'lib/cache')
-rw-r--r-- | lib/cache/lvmcache.c | 12 | ||||
-rw-r--r-- | lib/cache/lvmetad.c | 11 |
2 files changed, 17 insertions, 6 deletions
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 8936809b..6f9cfada 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -1005,12 +1005,14 @@ static int _free_vginfo(struct lvmcache_vginfo *vginfo) vginfo->vgname); r = 0; } - } else do - if (vginfo2->next == vginfo) { - vginfo2->next = vginfo->next; - break; + } else + while (vginfo2) { + if (vginfo2->next == vginfo) { + vginfo2->next = vginfo->next; + break; + } + vginfo2 = vginfo2->next; } - while ((vginfo2 = vginfo2->next)); dm_free(vginfo->vgname); dm_free(vginfo->creation_host); diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c index db092acc..6e1759b4 100644 --- a/lib/cache/lvmetad.c +++ b/lib/cache/lvmetad.c @@ -199,7 +199,11 @@ struct volume_group *lvmetad_vg_lookup(struct cmd_context *cmd, const char *vgna if (!strcmp(daemon_reply_str(reply, "response", ""), "OK")) { - top = dm_config_find_node(reply.cft->root, "metadata"); + if (!(top = dm_config_find_node(reply.cft->root, "metadata"))) { + log_error(INTERNAL_ERROR "metadata config node not found."); + goto out; + } + name = daemon_reply_str(reply, "name", NULL); /* fall back to lvm2 if we don't know better */ @@ -593,6 +597,11 @@ int lvmetad_pv_found(struct id pvid, struct device *device, const struct format_ "metadata = %b", strchr(buf, '{'), NULL); } else { + if (handler) { + log_error(INTERNAL_ERROR "Handler needs existing VG."); + dm_free(pvmeta); + return 0; + } /* There are no MDAs on this PV. */ reply = daemon_send_simple(_lvmetad, "pv_found", |