mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
lvmetad: Properly grab locks in pv_gone.
This commit is contained in:
parent
805f7e4042
commit
d888a0557e
@ -796,11 +796,23 @@ 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));
|
||||||
|
const char *vgid = dm_strdup(dm_hash_lookup(s->pvid_to_vgid, pvid));
|
||||||
|
|
||||||
|
if (!vgid) {
|
||||||
|
unlock_pvid_to_pvmeta(s);
|
||||||
|
return reply_fail("out of memory");
|
||||||
|
}
|
||||||
|
|
||||||
dm_hash_remove_binary(s->device_to_pvid, &device, sizeof(device));
|
dm_hash_remove_binary(s->device_to_pvid, &device, sizeof(device));
|
||||||
dm_hash_remove(s->pvid_to_pvmeta, pvid);
|
dm_hash_remove(s->pvid_to_pvmeta, pvid);
|
||||||
vg_remove_if_missing(s, dm_hash_lookup(s->pvid_to_vgid, pvid), 1);
|
|
||||||
unlock_pvid_to_pvmeta(s);
|
unlock_pvid_to_pvmeta(s);
|
||||||
|
|
||||||
|
lock_vg(s, vgid);
|
||||||
|
vg_remove_if_missing(s, vgid, 1);
|
||||||
|
unlock_vg(s, vgid);
|
||||||
|
|
||||||
|
dm_free(vgid);
|
||||||
|
|
||||||
if (pvid_old)
|
if (pvid_old)
|
||||||
dm_free(pvid_old);
|
dm_free(pvid_old);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user