]> sourceware.org Git - lvm2.git/commitdiff
lvmetad: Fix vgname->vgid hash updates w/ duplicate VG names.
authorPetr Rockai <prockai@redhat.com>
Fri, 4 Oct 2013 12:30:00 +0000 (14:30 +0200)
committerPetr Rockai <prockai@redhat.com>
Fri, 4 Oct 2013 12:31:45 +0000 (14:31 +0200)
daemons/lvmetad/lvmetad-core.c

index 4f7bf59ed1c9fb27e808e6407cfc978f45e3bcba..e1ec5a848d88e84b93f9c65fa451a72972cc0254 100644 (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->vgname_to_vgid, name, (void*) vgid)) ? 1 : 0;
 
-       if (retval && oldname && strcmp(name, oldname))
-               dm_hash_remove(s->vgname_to_vgid, oldname);
+       if (retval && oldname && strcmp(name, 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)
                dm_config_destroy(old);
This page took 0.037206 seconds and 5 git commands to generate.