mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmcache: fix valgrind error when dropping md duplicate
When lvmcache info is dropped because it's an md component, then the lvmcache vginfo can also be dropped, but the list iterator was still using the list head in vginfo, so break from the loop earlier to avoid it.
This commit is contained in:
parent
ffead4f333
commit
6d262eaf64
7
lib/cache/lvmcache.c
vendored
7
lib/cache/lvmcache.c
vendored
@ -1503,6 +1503,9 @@ void lvmcache_extra_md_component_checks(struct cmd_context *cmd)
|
||||
*/
|
||||
|
||||
dm_list_iterate_items_safe(vginfo, vginfo2, &_vginfos) {
|
||||
char vgid[ID_LEN + 1] __attribute__((aligned(8))) = { 0 };
|
||||
memcpy(vgid, vginfo->vgid, ID_LEN);
|
||||
|
||||
dm_list_iterate_items_safe(info, info2, &vginfo->infos) {
|
||||
dev = info->dev;
|
||||
device_hint = _get_pvsummary_device_hint(dev->pvid);
|
||||
@ -1557,6 +1560,10 @@ void lvmcache_extra_md_component_checks(struct cmd_context *cmd)
|
||||
/* lvmcache_del will also delete vginfo if info was last one */
|
||||
lvmcache_del(info);
|
||||
cmd->filter->wipe(cmd, cmd->filter, dev, NULL);
|
||||
|
||||
/* If vginfo was deleted don't continue using vginfo->infos */
|
||||
if (!_search_vginfos_list(NULL, vgid))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user