From 04fa77c3be1634ccdb8bf03b45effb04eaad8523 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Wed, 3 Feb 2010 14:08:39 +0000 Subject: This is related to liblvm and its lvm_list_vg_names() and lvm_list_vg_uuids() functions where we should not expose internal VG names/uuids (the ones with "#" prefix )through the interface. Otherwise, we could end up with library users opening internal VGs which will initiate locking mechanism that won't be cleaned up properly. "#orphans_{lvm1, lvm2, pool}" names are treated in a special way, they are truncated first to "orphans" and this is used as a part of the lock name then (e.g. while calling lvm_vg_open()). When library user calls lvm_vg_close(), the original name "orphans_{lvm1, lvm2, pool}" is used directly and therefore no unlock occurs. We should exclude internal VG names and uuids in the lists provided by lvmcache: lvmcache_get_vgids() and lvmcache_get_vgnames(). --- liblvm/lvm_vg.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'liblvm') diff --git a/liblvm/lvm_vg.c b/liblvm/lvm_vg.c index 4addc1cf..9a5c2392 100644 --- a/liblvm/lvm_vg.c +++ b/liblvm/lvm_vg.c @@ -315,19 +315,14 @@ char *lvm_vg_get_name(const vg_t vg) return name; } -/* - * FIXME: These functions currently return hidden VGs. We should either filter - * these out and not return them in the list, or export something like - * is_orphan_vg and tell the caller to filter. - */ struct dm_list *lvm_list_vg_names(lvm_t libh) { - return get_vgnames((struct cmd_context *)libh, 0); + return get_vgnames((struct cmd_context *)libh, 0, 0); } struct dm_list *lvm_list_vg_uuids(lvm_t libh) { - return get_vgids((struct cmd_context *)libh, 0); + return get_vgids((struct cmd_context *)libh, 0, 0); } /* -- cgit