1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvmetad: Fix vgname->vgid hash updates w/ duplicate VG names.

This commit is contained in:
Petr Rockai 2013-10-04 14:30:00 +02:00
parent a7ff7aee4f
commit 0d03503a45

View File

@ -753,8 +753,11 @@ static int update_metadata(lvmetad_state *s, const char *name, const char *_vgid
dm_hash_insert(s->vgid_to_vgname, vgid, cfgname) && dm_hash_insert(s->vgid_to_vgname, vgid, cfgname) &&
dm_hash_insert(s->vgname_to_vgid, name, (void*) vgid)) ? 1 : 0; dm_hash_insert(s->vgname_to_vgid, name, (void*) vgid)) ? 1 : 0;
if (retval && oldname && strcmp(name, oldname)) if (retval && oldname && strcmp(name, oldname)) {
dm_hash_remove(s->vgname_to_vgid, oldname); const char *vgid_prev = dm_hash_lookup(s->vgname_to_vgid, oldname);
if (vgid_prev && !strcmp(vgid_prev, vgid))
dm_hash_remove(s->vgname_to_vgid, oldname);
}
if (haveseq >= 0 && haveseq < seq) if (haveseq >= 0 && haveseq < seq)
dm_config_destroy(old); dm_config_destroy(old);