mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmetad: Do not try to lock a NULL vgid.
This commit is contained in:
parent
17f3b8280b
commit
bcb44281b7
@ -796,9 +796,9 @@ static response pv_gone(lvmetad_state *s, request r)
|
|||||||
|
|
||||||
pvmeta = dm_hash_lookup(s->pvid_to_pvmeta, pvid);
|
pvmeta = dm_hash_lookup(s->pvid_to_pvmeta, pvid);
|
||||||
pvid_old = dm_hash_lookup_binary(s->device_to_pvid, &device, sizeof(device));
|
pvid_old = dm_hash_lookup_binary(s->device_to_pvid, &device, sizeof(device));
|
||||||
char *vgid = dm_strdup(dm_hash_lookup(s->pvid_to_vgid, pvid));
|
const char *vgid = dm_hash_lookup(s->pvid_to_vgid, pvid);
|
||||||
|
|
||||||
if (!vgid) {
|
if (vgid && !(vgid = dm_strdup(vgid))) {
|
||||||
unlock_pvid_to_pvmeta(s);
|
unlock_pvid_to_pvmeta(s);
|
||||||
return reply_fail("out of memory");
|
return reply_fail("out of memory");
|
||||||
}
|
}
|
||||||
@ -807,11 +807,12 @@ static response pv_gone(lvmetad_state *s, request r)
|
|||||||
dm_hash_remove(s->pvid_to_pvmeta, pvid);
|
dm_hash_remove(s->pvid_to_pvmeta, pvid);
|
||||||
unlock_pvid_to_pvmeta(s);
|
unlock_pvid_to_pvmeta(s);
|
||||||
|
|
||||||
lock_vg(s, vgid);
|
if (vgid) {
|
||||||
vg_remove_if_missing(s, vgid, 1);
|
lock_vg(s, vgid);
|
||||||
unlock_vg(s, vgid);
|
vg_remove_if_missing(s, vgid, 1);
|
||||||
|
unlock_vg(s, vgid);
|
||||||
dm_free(vgid);
|
dm_free(vgid);
|
||||||
|
}
|
||||||
|
|
||||||
if (pvid_old)
|
if (pvid_old)
|
||||||
dm_free(pvid_old);
|
dm_free(pvid_old);
|
||||||
|
Loading…
Reference in New Issue
Block a user