master - libdm: check for passed custom time value
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=96d73dc6ea3016...
Commit: 96d73dc6ea3016a80b5041ee0252e8473481b91e
Parent: d4288c9bdfa104bef1e31185da0b773924218f35
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 16 00:41:25 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 16 01:16:11 2015 +0100
libdm: check for passed custom time value
Coverity reports custom should be checked before derefernce.
---
libdm/libdm-report.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 37fcc40..790f84f 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -3545,6 +3545,10 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
if (rvw->reserved->type & DM_REPORT_FIELD_RESERVED_VALUE_RANGE)
fs->value->next->v.t = (((const time_t *) rvw->value)[1]);
} else {
+ if (!custom) {
+ log_error(INTERNAL_ERROR "Custom time value is undefined.");
+ goto error;
+ }
tval = (struct time_value *) custom;
fs->value->v.t = tval->t1;
if (tval->range)
8 years, 5 months
master - libdm: check for null from pool strdup
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d4288c9bdfa104...
Commit: d4288c9bdfa104bef1e31185da0b773924218f35
Parent: 422c7474ca97066ab92d145ac45bc4a9cd38e1b7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 16 00:00:32 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 16 01:16:09 2015 +0100
libdm: check for null from pool strdup
Unlikely to happen, but Coverity shown we may have possible
derefer NULL pointer.
---
WHATS_NEW_DM | 1 +
libdm/libdm-string.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 795776b..5e9228a 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.111 -
====================================
+ Add missing check for allocation inside dm_split_lvm_name().
Test dm_task_get_message_response for !NULL in dm_stats_print_region().
Add checks for failing dm_stats_create() in dmsetup.
Add missing fifo close when failed to initialize client connection.
diff --git a/libdm/libdm-string.c b/libdm/libdm-string.c
index 587abfe..9132832 100644
--- a/libdm/libdm-string.c
+++ b/libdm/libdm-string.c
@@ -95,8 +95,10 @@ static char *_unquote(char *component)
int dm_split_lvm_name(struct dm_pool *mem, const char *dmname,
char **vgname, char **lvname, char **layer)
{
- if (mem)
- *vgname = dm_pool_strdup(mem, dmname);
+ if (mem && !(*vgname = dm_pool_strdup(mem, dmname))) {
+ log_error("Failed to duplicate dmname.");
+ return 0;
+ }
if (!*vgname)
return 0;
8 years, 5 months
master - libdm: check if passed return pointer is not NULL
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=422c7474ca9706...
Commit: 422c7474ca97066ab92d145ac45bc4a9cd38e1b7
Parent: dd9a05b5ae7fb12cf2efd779f3f2da44698805b5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 16 00:13:10 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 16 01:15:04 2015 +0100
libdm: check if passed return pointer is not NULL
Coverity: before storing return value, check passed space will
not dereference NULL pointer.
---
libdm/libdm-report.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 38dde07..37fcc40 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -2692,13 +2692,15 @@ static const char *_tok_value_string_list(const struct dm_report_field_type *ft,
dm_free(arr);
out:
*end = s;
- *sel_str_list = ssl;
+ if (*sel_str_list)
+ *sel_str_list = ssl;
return s;
bad:
*end = s;
if (ssl)
dm_pool_free(mem, ssl);
- *sel_str_list = NULL;
+ if (*sel_str_list)
+ *sel_str_list = NULL;
return s;
}
8 years, 5 months
master - man: improve cmirrord.8 manpage
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dd9a05b5ae7fb1...
Commit: dd9a05b5ae7fb12cf2efd779f3f2da44698805b5
Parent: 376892ddf8e6a1c3e50240193d6df63418d9392d
Author: Stéphane Aulery <saulery(a)free.fr>
AuthorDate: Thu Nov 27 02:32:38 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 16 01:15:03 2015 +0100
man: improve cmirrord.8 manpage
- Keywords in bold
- Add syslog and signal ref.
- Sort see also sections
Signed-off-by: Stéphane Aulery <saulery(a)free.fr>
---
man/cmirrord.8.in | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/man/cmirrord.8.in b/man/cmirrord.8.in
index 383db65..ad604c7 100644
--- a/man/cmirrord.8.in
+++ b/man/cmirrord.8.in
@@ -6,7 +6,7 @@ cmirrord \(em cluster mirror log daemon
\fBcmirrord\fR [\fB\-f\fR] [\fB\-h\fR]
.SH DESCRIPTION
-cmirrord is the daemon that tracks mirror log information in a cluster.
+\fBcmirrord\fP is the daemon that tracks mirror log information in a cluster.
It is specific to device-mapper based mirrors (and by extension, LVM
cluster mirrors). Cluster mirrors are not possible without this daemon
running.
@@ -14,15 +14,16 @@ running.
This daemon relies on the cluster infrastructure provided by the
Cluster MANager (CMAN), which must be set up and running in order for
cmirrord to function. (The cluster infrastructure is also required for
-clvmd.)
+\fBclvmd\fP(8).)
-Output is logged via syslog. The USR1 signal can be issued to cmirrord
-to gather current status information for debugging purposes.
+Output is logged via \fBsyslog\fP(3). The \fBSIGUSR1 signal\fP(7) can be
+issued to \fBcmirrord\fP to gather current status information for debugging
+purposes.
-Once started, cmirrord will run until it is shutdown via INT signal. If
-there are still active cluster mirrors, however, the signal will be
-ignored. Active cluster mirrors should be shutdown before stopping the
-cluster mirror log daemon.
+Once started, \fBcmirrord\fP will run until it is shutdown via \fBSIGINT\fP
+signal. If there are still active cluster mirrors, however, the signal will be
+ignored. Active cluster mirrors should be shutdown before stopping the cluster
+mirror log daemon.
.SH OPTIONS
.IP "\fB\-f\fR, \fB\-\-foreground\fR" 4
@@ -31,6 +32,8 @@ Do not fork and log to the terminal.
Print usage.
.SH SEE ALSO
+.BR syslog (3),
+.BR cluster.conf (5),
+.BR signal (7),
+.BR clvmd (8),
.BR lvm (8)
-.BR clvmd (8)
-.BR cluster.conf (5)
8 years, 5 months
master - clvmd: remove -v option from getopt
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=376892ddf8e6a1...
Commit: 376892ddf8e6a1c3e50240193d6df63418d9392d
Parent: e31f4b76f470c7da7328d16551cfaba9cae4674a
Author: Stéphane Aulery <saulery(a)free.fr>
AuthorDate: Tue Nov 25 02:57:22 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 16 01:15:03 2015 +0100
clvmd: remove -v option from getopt
-V is documented, not -v.
Signed-off-by: Stéphane Aulery <saulery(a)free.fr>
---
daemons/clvmd/clvmd.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index 96cb697..3f21aba 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -374,7 +374,7 @@ int main(int argc, char *argv[])
/* Deal with command-line arguments */
opterr = 0;
optind = 0;
- while ((opt = getopt_long(argc, argv, "vVhfd:t:RST:CI:E:",
+ while ((opt = getopt_long(argc, argv, "Vhfd:t:RST:CI:E:",
longopts, NULL)) != -1) {
switch (opt) {
case 'h':
8 years, 5 months
master - cache: handle older metadata format
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e31f4b76f470c7...
Commit: e31f4b76f470c7da7328d16551cfaba9cae4674a
Parent: d9295410e98e32636d3bf03ee375c5739bd44b23
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Nov 15 20:03:08 2015 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 16 01:12:57 2015 +0100
cache: handle older metadata format
When reading older lvm2 metadata for cache-pool - we now handle more
extended syntax - basically we want to enter most setting when
actually creating cached LV.
For this new validation code has been added. However older metadata
without new settings set is now found as invalid.
Fix it by adding default settings for cache policy mq
and cache mode writethrough.
---
WHATS_NEW | 1 +
lib/cache_segtype/cache.c | 34 +++++++++++++++++++++++++++++++
test/shell/lvchange-cache-old.sh | 41 ++++++++++++++++++++++++++++++++++++++
3 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2dea99c..d5a4a3b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.135 -
====================================
+ Fix reading of old metadata with missing cache policy or mode settings.
Issue error if external_device_info_source=udev and udev db record incomplete.
Fix passing of 32bit values through daemons (mostly lvmlockd).
Use local memory pool for whole alloc_handle manipulation.
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index 733c330..033cabe 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -34,6 +34,32 @@ static unsigned _feature_mask;
log_error(t " segment %s of logical volume %s.", ## p, \
dm_config_parent_name(sn), seg->lv->name), 0;
+/*
+ * When older metadata are loaded without newer settings,
+ * set then to default settings (the one that could have been
+ * used implicitely at that time).
+ *
+ * Needs both segments cache and cache_pool to be loaded.
+ */
+static int _fix_missing_defaults(struct lv_segment *cpool_seg)
+{
+ if (!cpool_seg->policy_name) {
+ cpool_seg->policy_name = "mq";
+ log_verbose("Cache is missing cache policy, using %s.",
+ cpool_seg->policy_name);
+ }
+
+ if (!cache_mode_is_set(cpool_seg)) {
+ if (!cache_set_mode(cpool_seg, "writethrough")) {
+ log_error(INTERNAL_ERROR "Failed to writethrough cache mode.");
+ return 0;
+ }
+ log_verbose("Cache is missing cache mode, using %s.",
+ get_cache_mode_name(cpool_seg));
+ }
+
+ return 1;
+}
static int _cache_pool_text_import(struct lv_segment *seg,
const struct dm_config_node *sn,
@@ -115,6 +141,10 @@ static int _cache_pool_text_import(struct lv_segment *seg,
if (!attach_pool_metadata_lv(seg, meta_lv))
return_0;
+ if (!dm_list_empty(&seg->lv->segs_using_this_lv) &&
+ !_fix_missing_defaults(seg))
+ return_0;
+
return 1;
}
@@ -319,6 +349,10 @@ static int _cache_text_import(struct lv_segment *seg,
if (!attach_pool_lv(seg, pool_lv, NULL, NULL))
return_0;
+ if (!dm_list_empty(&pool_lv->segments) &&
+ !_fix_missing_defaults(first_seg(pool_lv)))
+ return_0;
+
return 1;
}
diff --git a/test/shell/lvchange-cache-old.sh b/test/shell/lvchange-cache-old.sh
new file mode 100644
index 0000000..0b6ef7c
--- /dev/null
+++ b/test/shell/lvchange-cache-old.sh
@@ -0,0 +1,41 @@
+#!/bin/sh
+# Copyright (C) 2015 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+# Exercise usage of older metadata which are missing some new settings
+
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+aux have_cache 1 3 0 || skip
+
+# FIXME: parallel cache metadata allocator is crashing when used value 8000!
+aux prepare_vg 5 80
+
+
+lvcreate -l 10 --type cache-pool $vg/cpool
+lvcreate -l 20 -H -n $lv1 $vg/cpool
+
+vgcfgbackup -f backup $vg
+
+# check metadata without cache policy
+lvchange -an $vg
+grep -v "policy =" backup >backup_1
+vgcfgrestore -f backup_1 $vg
+lvchange -ay $vg
+
+# check metadata without cache mode
+lvchange -an $vg
+grep -v "cache_mode =" backup >backup_2
+vgcfgrestore -f backup_2 $vg
+lvchange -ay $vg
+
+vgremove -ff $vg
8 years, 5 months
master - lvmetad: change the new hash to take data len
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d9295410e98e32...
Commit: d9295410e98e32636d3bf03ee375c5739bd44b23
Parent: e425bce28132e4bad940fae5bfb1499d6a15391d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Nov 13 16:54:22 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Nov 13 16:54:22 2015 -0600
lvmetad: change the new hash to take data len
If the data len is passed into the hash table
and saved there, then the hash table internals
do not need to assume that the data value is
a string at any point.
---
daemons/lvmetad/lvmetad-core.c | 28 ++++++++++++++--------------
libdm/.exported_symbols.Base | 8 ++++----
libdm/datastruct/hash.c | 23 +++++++++++++----------
libdm/libdevmapper.h | 22 ++++++++--------------
4 files changed, 39 insertions(+), 42 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index d54dded..0fddd7c 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -736,7 +736,7 @@ static response vg_lookup(lvmetad_state *s, request r)
lock_vgid_to_metadata(s);
if (name && !uuid)
- uuid = dm_hash_lookup_str_multival(s->vgname_to_vgid, name, &uuid2);
+ uuid = dm_hash_lookup_multival(s->vgname_to_vgid, name, (void *)&uuid2);
else if (uuid && !name)
name = dm_hash_lookup(s->vgid_to_vgname, uuid);
unlock_vgid_to_metadata(s);
@@ -749,7 +749,7 @@ static response vg_lookup(lvmetad_state *s, request r)
} else {
char *name_lookup = dm_hash_lookup(s->vgid_to_vgname, uuid);
- char *uuid_lookup = dm_hash_lookup_str_withval(s->vgname_to_vgid, name, uuid);
+ char *uuid_lookup = dm_hash_lookup_withval(s->vgname_to_vgid, name, uuid, strlen(uuid) + 1);
/* FIXME: comment out these sanity checks when not testing */
@@ -920,7 +920,7 @@ static int remove_metadata(lvmetad_state *s, const char *vgid, int update_pvids)
name_lookup = dm_hash_lookup(s->vgid_to_vgname, vgid);
outdated_pvs_lookup = dm_hash_lookup(s->vgid_to_outdated_pvs, vgid);
if (name_lookup)
- vgid_lookup = dm_hash_lookup_str_withval(s->vgname_to_vgid, name_lookup, vgid);
+ vgid_lookup = dm_hash_lookup_withval(s->vgname_to_vgid, name_lookup, vgid, strlen(vgid) + 1);
/* remove hash table mappings */
@@ -929,7 +929,7 @@ static int remove_metadata(lvmetad_state *s, const char *vgid, int update_pvids)
dm_hash_remove(s->vgid_to_vgname, vgid);
dm_hash_remove(s->vgid_to_outdated_pvs, vgid);
if (name_lookup)
- dm_hash_remove_str_withval(s->vgname_to_vgid, name_lookup, vgid);
+ dm_hash_remove_withval(s->vgname_to_vgid, name_lookup, vgid, strlen(vgid) + 1);
unlock_vgid_to_metadata(s);
@@ -1009,8 +1009,8 @@ static void _purge_metadata(lvmetad_state *s, const char *arg_name, const char *
lock_pvid_to_vgid(s);
remove_metadata(s, arg_vgid, 1);
- if ((rem_vgid = dm_hash_lookup_str_withval(s->vgname_to_vgid, arg_name, arg_vgid))) {
- dm_hash_remove_str_withval(s->vgname_to_vgid, arg_name, arg_vgid);
+ if ((rem_vgid = dm_hash_lookup_withval(s->vgname_to_vgid, arg_name, arg_vgid, strlen(arg_vgid) + 1))) {
+ dm_hash_remove_withval(s->vgname_to_vgid, arg_name, arg_vgid, strlen(arg_vgid) + 1);
dm_free(rem_vgid);
}
unlock_pvid_to_vgid(s);
@@ -1077,7 +1077,7 @@ static int _update_metadata_new_vgid(lvmetad_state *s,
dm_config_destroy(old_meta);
old_meta = NULL;
- dm_hash_remove_str_withval(s->vgname_to_vgid, arg_name, old_vgid);
+ dm_hash_remove_withval(s->vgname_to_vgid, arg_name, old_vgid, strlen(old_vgid) + 1);
dm_hash_remove(s->vgid_to_vgname, old_vgid);
dm_free((char *)old_vgid);
old_vgid = NULL;
@@ -1098,7 +1098,7 @@ static int _update_metadata_new_vgid(lvmetad_state *s,
goto out;
}
- if (!dm_hash_insert_str_multival(s->vgname_to_vgid, arg_name, new_vgid_dup)) {
+ if (!dm_hash_insert_multival(s->vgname_to_vgid, arg_name, new_vgid_dup, strlen(new_vgid_dup) + 1)) {
ERROR(s, "update_metadata_new_vgid out of memory for vgid hash insert for %s %s", arg_name, new_vgid);
abort_daemon = 1;
goto out;
@@ -1192,7 +1192,7 @@ static int _update_metadata_new_name(lvmetad_state *s,
old_meta = NULL;
dm_hash_remove(s->vgid_to_vgname, arg_vgid);
- dm_hash_remove_str_withval(s->vgname_to_vgid, old_name, arg_vgid);
+ dm_hash_remove_withval(s->vgname_to_vgid, old_name, arg_vgid, strlen(arg_vgid) + 1);
dm_free((char *)old_name);
old_name = NULL;
@@ -1212,7 +1212,7 @@ static int _update_metadata_new_name(lvmetad_state *s,
goto out;
}
- if (!dm_hash_insert_str_multival(s->vgname_to_vgid, new_name, arg_vgid_dup)) {
+ if (!dm_hash_insert_multival(s->vgname_to_vgid, new_name, arg_vgid_dup, strlen(arg_vgid_dup) + 1)) {
ERROR(s, "update_metadata_new_name out of memory for vgid hash insert for %s %s", new_name, arg_vgid);
abort_daemon = 1;
goto out;
@@ -1281,7 +1281,7 @@ static int _update_metadata_add_new(lvmetad_state *s, const char *new_name, cons
goto out;
}
- if (!dm_hash_insert_str_multival(s->vgname_to_vgid, new_name, new_vgid_dup)) {
+ if (!dm_hash_insert_multival(s->vgname_to_vgid, new_name, new_vgid_dup, strlen(new_vgid_dup) + 1)) {
ERROR(s, "update_metadata_add_new out of memory for vgid hash insert for %s %s", new_name, new_vgid);
abort_daemon = 1;
goto out;
@@ -1381,7 +1381,7 @@ static int _update_metadata(lvmetad_state *s, const char *arg_name, const char *
*/
if (pvid && !arg_name_lookup && arg_vgid_lookup &&
strcmp(arg_vgid_lookup, arg_vgid)) {
- if ((arg_vgid2 = dm_hash_lookup_str_withval(s->vgname_to_vgid, arg_name, arg_vgid))) {
+ if ((arg_vgid2 = dm_hash_lookup_withval(s->vgname_to_vgid, arg_name, arg_vgid, strlen(arg_vgid) + 1))) {
/* This VG already exists in the cache. */
DEBUGLOG(s, "update_metadata arg_vgid %s arg_name %s found VG with same name as %s",
arg_vgid, arg_name, arg_vgid_lookup);
@@ -1402,7 +1402,7 @@ static int _update_metadata(lvmetad_state *s, const char *arg_name, const char *
if (!pvid && arg_name_lookup && arg_vgid_lookup &&
!strcmp(arg_name_lookup, arg_name) &&
strcmp(arg_vgid_lookup, arg_vgid)) {
- if ((arg_vgid2 = dm_hash_lookup_str_withval(s->vgname_to_vgid, arg_name, arg_vgid))) {
+ if ((arg_vgid2 = dm_hash_lookup_withval(s->vgname_to_vgid, arg_name, arg_vgid, strlen(arg_vgid) + 1))) {
/* The first lookup found the another VG with the same name. */
DEBUGLOG(s, "update_metadata arg_vgid %s arg_name %s update VG with same name as %s",
arg_vgid, arg_name, arg_vgid_lookup);
@@ -1442,7 +1442,7 @@ static int _update_metadata(lvmetad_state *s, const char *arg_name, const char *
}
new_vgid = arg_vgid;
- old_vgid = dm_hash_lookup_str_multival(s->vgname_to_vgid, arg_name, &old_vgid2);
+ old_vgid = dm_hash_lookup_multival(s->vgname_to_vgid, arg_name, (void *)&old_vgid2);
/*
* FIXME: this ensures that arg_name maps to only one existing
diff --git a/libdm/.exported_symbols.Base b/libdm/.exported_symbols.Base
index 30e6a2b..61df67c 100644
--- a/libdm/.exported_symbols.Base
+++ b/libdm/.exported_symbols.Base
@@ -92,10 +92,10 @@ dm_hash_lookup_binary
dm_hash_remove
dm_hash_remove_binary
dm_hash_wipe
-dm_hash_lookup_str_withval
-dm_hash_lookup_str_multival
-dm_hash_remove_str_withval
-dm_hash_insert_str_multival
+dm_hash_lookup_withval
+dm_hash_lookup_multival
+dm_hash_remove_withval
+dm_hash_insert_multival
dm_is_dm_major
dm_is_empty_dir
dm_lib_exit
diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c
index cf18226..406f5fd 100644
--- a/libdm/datastruct/hash.c
+++ b/libdm/datastruct/hash.c
@@ -18,6 +18,7 @@
struct dm_hash_node {
struct dm_hash_node *next;
void *data;
+ unsigned data_len;
unsigned keylen;
char key[0];
};
@@ -222,10 +223,8 @@ static struct dm_hash_node **_find_str_withval(struct dm_hash_table *t,
continue;
if (!memcmp(key, (*c)->key, len) && (*c)->data) {
- char *str = (char *)((*c)->data);
-
- if (((strlen(str) + 1) == val_len) &&
- !memcmp(val, str, val_len))
+ if (((*c)->data_len == val_len) &&
+ !memcmp(val, (*c)->data, val_len))
return c;
}
}
@@ -233,7 +232,8 @@ static struct dm_hash_node **_find_str_withval(struct dm_hash_table *t,
return NULL;
}
-int dm_hash_insert_str_multival(struct dm_hash_table *t, const char *key, const char *val)
+int dm_hash_insert_multival(struct dm_hash_table *t, const char *key,
+ const void *val, uint32_t val_len)
{
struct dm_hash_node *n;
struct dm_hash_node *first;
@@ -245,6 +245,7 @@ int dm_hash_insert_str_multival(struct dm_hash_table *t, const char *key, const
return 0;
n->data = (void *)val;
+ n->data_len = val_len;
h = _hash(key, len) & (t->num_slots - 1);
@@ -264,11 +265,12 @@ int dm_hash_insert_str_multival(struct dm_hash_table *t, const char *key, const
* Look through multiple entries with the same key for one that has a
* matching val and return that. If none have maching val, return NULL.
*/
-void *dm_hash_lookup_str_withval(struct dm_hash_table *t, const char *key, const char *val)
+void *dm_hash_lookup_withval(struct dm_hash_table *t, const char *key,
+ const void *val, uint32_t val_len)
{
struct dm_hash_node **c;
- c = _find_str_withval(t, key, val, strlen(key) + 1, strlen(val) + 1);
+ c = _find_str_withval(t, key, val, strlen(key) + 1, val_len);
return (c && *c) ? (*c)->data : 0;
}
@@ -277,11 +279,12 @@ void *dm_hash_lookup_str_withval(struct dm_hash_table *t, const char *key, const
* Look through multiple entries with the same key for one that has a
* matching val and remove that.
*/
-void dm_hash_remove_str_withval(struct dm_hash_table *t, const char *key, const char *val)
+void dm_hash_remove_withval(struct dm_hash_table *t, const char *key,
+ const void *val, uint32_t val_len)
{
struct dm_hash_node **c;
- c = _find_str_withval(t, key, val, strlen(key) + 1, strlen(val) + 1);
+ c = _find_str_withval(t, key, val, strlen(key) + 1, val_len);
if (c && *c) {
struct dm_hash_node *old = *c;
@@ -306,7 +309,7 @@ void dm_hash_remove_str_withval(struct dm_hash_table *t, const char *key, const
* If more than two entries have the key, the function looks
* at only the first two.
*/
-void *dm_hash_lookup_str_multival(struct dm_hash_table *t, const char *key, const char **val2)
+void *dm_hash_lookup_multival(struct dm_hash_table *t, const char *key, const void **val2)
{
struct dm_hash_node **c;
struct dm_hash_node **c1 = NULL;
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index de2dc3e..a240d0e 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1849,20 +1849,14 @@ void *dm_hash_get_data(struct dm_hash_table *t, struct dm_hash_node *n);
struct dm_hash_node *dm_hash_get_first(struct dm_hash_table *t);
struct dm_hash_node *dm_hash_get_next(struct dm_hash_table *t, struct dm_hash_node *n);
-/*
- * Using these requires that string values were inserted.
- * They support the case where multiple values with the
- * same key are inserted.
- *
- * The "withval" variants ensure that an entry matches
- * both the specified key and value. They are used to
- * return or remove a unique entry by specifiying both
- * the key and the value.
- */
-int dm_hash_insert_str_multival(struct dm_hash_table *t, const char *key, const char *val);
-void *dm_hash_lookup_str_multival(struct dm_hash_table *t, const char *key, const char **val2);
-void *dm_hash_lookup_str_withval(struct dm_hash_table *t, const char *key, const char *val);
-void dm_hash_remove_str_withval(struct dm_hash_table *t, const char *key, const char *val);
+void *dm_hash_lookup_withval(struct dm_hash_table *t, const char *key,
+ const void *val, uint32_t val_len);
+void dm_hash_remove_withval(struct dm_hash_table *t, const char *key,
+ const void *val, uint32_t val_len);
+int dm_hash_insert_multival(struct dm_hash_table *t, const char *key,
+ const void *val, uint32_t val_len);
+void *dm_hash_lookup_multival(struct dm_hash_table *t, const char *key, const void **val2);
+
#define dm_hash_iterate(v, h) \
for (v = dm_hash_get_first((h)); v; \
8 years, 5 months
master - tests: allow lvmetad tests with duplicate VG names
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e425bce28132e4...
Commit: e425bce28132e4bad940fae5bfb1499d6a15391d
Parent: 46193f4a59f30d69aa30c9af6aa68f8dec1e81b2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Nov 13 15:09:26 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Nov 13 15:09:26 2015 -0600
tests: allow lvmetad tests with duplicate VG names
---
test/shell/process-each-duplicate-vgnames.sh | 1 -
test/shell/vgrename-usage.sh | 12 ------------
2 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/test/shell/process-each-duplicate-vgnames.sh b/test/shell/process-each-duplicate-vgnames.sh
index 5cdf32b..90d3e23 100644
--- a/test/shell/process-each-duplicate-vgnames.sh
+++ b/test/shell/process-each-duplicate-vgnames.sh
@@ -7,7 +7,6 @@
test_description='Test vgs with duplicate vg names'
SKIP_WITH_LVMPOLLD=1
-SKIP_WITH_LVMETAD=1
. lib/inittest
diff --git a/test/shell/vgrename-usage.sh b/test/shell/vgrename-usage.sh
index 8893c0f..92070e8 100644
--- a/test/shell/vgrename-usage.sh
+++ b/test/shell/vgrename-usage.sh
@@ -41,18 +41,6 @@ vgcreate $vg2 "$dev2"
not vgrename $vg1 $vg2
vgremove $vg1 $vg2
-# FIXME: decide how lvmetad should handle
-# duplicate VG names. lvmetad now ignores
-# the VG on device B if it already knows
-# about the same VG name on device A.
-# This lets you vgrename the VG on device A
-# which allows the VG on device B to reappear
-# once it's rescanned.
-# It's not yet known how we want lvmetad to
-# handle duplicate VG names.
-
-test -e LOCAL_LVMETAD && exit 0
-
# vgrename duplicate name
vgcreate $vg1 "$dev1"
aux disable_dev "$dev1"
8 years, 5 months
master - lvmetad: handle duplicate VG names
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=46193f4a59f30d...
Commit: 46193f4a59f30d69aa30c9af6aa68f8dec1e81b2
Parent: 970a42890905e62c43d20b3b4eb0ec7ece0af11c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Nov 12 10:05:56 2015 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Nov 13 14:56:35 2015 -0600
lvmetad: handle duplicate VG names
New hash table functions are added that allow for
multiple entries with the same key. Use of the
vgname_to_vgid hash table is converted to these
new functions since there are multiple entries
in vgname_to_vgid that have the same key (vgname).
When multiple VGs with the same name exist, commands
that reference only a VG name will fail saying the
VG could not be found (that error message could be
improved.) Any command that works with the select
option can access one of the VGs with -S vg_uuid=X.
vgrename is a special case that allows the first VG
name arg to be replaced by a uuid, which also works.
(The existing hash table implementation is not well
suited for handling this case, but it works ok with
the new extensions. Changing lvmetad to use its own
custom hash tables may be preferable at some point.)
---
daemons/lvmetad/lvmetad-core.c | 91 +++++++++++++++++++++++----
libdm/.exported_symbols.Base | 4 +
libdm/datastruct/hash.c | 133 ++++++++++++++++++++++++++++++++++++++++
libdm/libdevmapper.h | 15 +++++
4 files changed, 230 insertions(+), 13 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index f7df5fd..d54dded 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -720,9 +720,9 @@ static response vg_lookup(lvmetad_state *s, request r)
struct dm_config_node *metadata, *n;
struct vg_info *info;
response res = { 0 };
-
const char *uuid = daemon_request_str(r, "uuid", NULL);
const char *name = daemon_request_str(r, "name", NULL);
+ const char *uuid2 = NULL;
buffer_init( &res.buffer );
@@ -736,17 +736,20 @@ static response vg_lookup(lvmetad_state *s, request r)
lock_vgid_to_metadata(s);
if (name && !uuid)
- uuid = dm_hash_lookup(s->vgname_to_vgid, name);
+ uuid = dm_hash_lookup_str_multival(s->vgname_to_vgid, name, &uuid2);
else if (uuid && !name)
name = dm_hash_lookup(s->vgid_to_vgname, uuid);
unlock_vgid_to_metadata(s);
+ if (name && uuid && uuid2)
+ return reply_unknown("Multiple VGs found with same name");
+
if (!uuid || !name)
return reply_unknown("VG not found");
} else {
char *name_lookup = dm_hash_lookup(s->vgid_to_vgname, uuid);
- char *uuid_lookup = dm_hash_lookup(s->vgname_to_vgid, name);
+ char *uuid_lookup = dm_hash_lookup_str_withval(s->vgname_to_vgid, name, uuid);
/* FIXME: comment out these sanity checks when not testing */
@@ -917,7 +920,7 @@ static int remove_metadata(lvmetad_state *s, const char *vgid, int update_pvids)
name_lookup = dm_hash_lookup(s->vgid_to_vgname, vgid);
outdated_pvs_lookup = dm_hash_lookup(s->vgid_to_outdated_pvs, vgid);
if (name_lookup)
- vgid_lookup = dm_hash_lookup(s->vgname_to_vgid, name_lookup);
+ vgid_lookup = dm_hash_lookup_str_withval(s->vgname_to_vgid, name_lookup, vgid);
/* remove hash table mappings */
@@ -926,7 +929,7 @@ static int remove_metadata(lvmetad_state *s, const char *vgid, int update_pvids)
dm_hash_remove(s->vgid_to_vgname, vgid);
dm_hash_remove(s->vgid_to_outdated_pvs, vgid);
if (name_lookup)
- dm_hash_remove(s->vgname_to_vgid, name_lookup);
+ dm_hash_remove_str_withval(s->vgname_to_vgid, name_lookup, vgid);
unlock_vgid_to_metadata(s);
@@ -1006,8 +1009,8 @@ static void _purge_metadata(lvmetad_state *s, const char *arg_name, const char *
lock_pvid_to_vgid(s);
remove_metadata(s, arg_vgid, 1);
- if ((rem_vgid = dm_hash_lookup(s->vgname_to_vgid, arg_name))) {
- dm_hash_remove(s->vgname_to_vgid, arg_name);
+ if ((rem_vgid = dm_hash_lookup_str_withval(s->vgname_to_vgid, arg_name, arg_vgid))) {
+ dm_hash_remove_str_withval(s->vgname_to_vgid, arg_name, arg_vgid);
dm_free(rem_vgid);
}
unlock_pvid_to_vgid(s);
@@ -1074,7 +1077,7 @@ static int _update_metadata_new_vgid(lvmetad_state *s,
dm_config_destroy(old_meta);
old_meta = NULL;
- dm_hash_remove(s->vgname_to_vgid, arg_name);
+ dm_hash_remove_str_withval(s->vgname_to_vgid, arg_name, old_vgid);
dm_hash_remove(s->vgid_to_vgname, old_vgid);
dm_free((char *)old_vgid);
old_vgid = NULL;
@@ -1095,7 +1098,7 @@ static int _update_metadata_new_vgid(lvmetad_state *s,
goto out;
}
- if (!dm_hash_insert(s->vgname_to_vgid, arg_name, new_vgid_dup)) {
+ if (!dm_hash_insert_str_multival(s->vgname_to_vgid, arg_name, new_vgid_dup)) {
ERROR(s, "update_metadata_new_vgid out of memory for vgid hash insert for %s %s", arg_name, new_vgid);
abort_daemon = 1;
goto out;
@@ -1189,7 +1192,7 @@ static int _update_metadata_new_name(lvmetad_state *s,
old_meta = NULL;
dm_hash_remove(s->vgid_to_vgname, arg_vgid);
- dm_hash_remove(s->vgname_to_vgid, old_name);
+ dm_hash_remove_str_withval(s->vgname_to_vgid, old_name, arg_vgid);
dm_free((char *)old_name);
old_name = NULL;
@@ -1209,7 +1212,7 @@ static int _update_metadata_new_name(lvmetad_state *s,
goto out;
}
- if (!dm_hash_insert(s->vgname_to_vgid, new_name, arg_vgid_dup)) {
+ if (!dm_hash_insert_str_multival(s->vgname_to_vgid, new_name, arg_vgid_dup)) {
ERROR(s, "update_metadata_new_name out of memory for vgid hash insert for %s %s", new_name, arg_vgid);
abort_daemon = 1;
goto out;
@@ -1278,7 +1281,7 @@ static int _update_metadata_add_new(lvmetad_state *s, const char *new_name, cons
goto out;
}
- if (!dm_hash_insert(s->vgname_to_vgid, new_name, new_vgid_dup)) {
+ if (!dm_hash_insert_str_multival(s->vgname_to_vgid, new_name, new_vgid_dup)) {
ERROR(s, "update_metadata_add_new out of memory for vgid hash insert for %s %s", new_name, new_vgid);
abort_daemon = 1;
goto out;
@@ -1339,6 +1342,8 @@ static int _update_metadata(lvmetad_state *s, const char *arg_name, const char *
const char *new_name = NULL;
const char *old_vgid = NULL;
const char *new_vgid = NULL;
+ const char *arg_vgid2 = NULL;
+ const char *old_vgid2 = NULL;
const char *new_metadata_vgid;
int old_seq = -1;
int new_seq = -1;
@@ -1368,6 +1373,46 @@ static int _update_metadata(lvmetad_state *s, const char *arg_name, const char *
arg_vgid_lookup = dm_hash_lookup(s->vgname_to_vgid, arg_name);
/*
+ * A new PV has been found with a VG that:
+ * has a vgid we don't know about (null arg_name_lookup),
+ * has a name we do know about (non-null arg_vgid_lookup).
+ * This happens when there are two different VGs with the
+ * same name.
+ */
+ if (pvid && !arg_name_lookup && arg_vgid_lookup &&
+ strcmp(arg_vgid_lookup, arg_vgid)) {
+ if ((arg_vgid2 = dm_hash_lookup_str_withval(s->vgname_to_vgid, arg_name, arg_vgid))) {
+ /* This VG already exists in the cache. */
+ DEBUGLOG(s, "update_metadata arg_vgid %s arg_name %s found VG with same name as %s",
+ arg_vgid, arg_name, arg_vgid_lookup);
+ arg_vgid_lookup = arg_vgid2;
+ } else {
+ /* This VG doesn't exist in cache yet. */
+ DEBUGLOG(s, "update_metadata arg_vgid %s arg_name %s found VG with same name as %s",
+ arg_vgid, arg_name, arg_vgid_lookup);
+ arg_vgid_lookup = NULL;
+ }
+ }
+
+ /*
+ * Updated VG metadata has been sent from a command
+ * for a VG but we have two VGs with this same name,
+ * so we need to figure out which of the VGs it is.
+ */
+ if (!pvid && arg_name_lookup && arg_vgid_lookup &&
+ !strcmp(arg_name_lookup, arg_name) &&
+ strcmp(arg_vgid_lookup, arg_vgid)) {
+ if ((arg_vgid2 = dm_hash_lookup_str_withval(s->vgname_to_vgid, arg_name, arg_vgid))) {
+ /* The first lookup found the another VG with the same name. */
+ DEBUGLOG(s, "update_metadata arg_vgid %s arg_name %s update VG with same name as %s",
+ arg_vgid, arg_name, arg_vgid_lookup);
+ arg_vgid_lookup = arg_vgid2;
+ } else {
+ /* This case is detected as an error below. */
+ }
+ }
+
+ /*
* A new VG when there is no existing record of the name or vgid args.
*/
if (!arg_name_lookup && !arg_vgid_lookup) {
@@ -1397,7 +1442,22 @@ static int _update_metadata(lvmetad_state *s, const char *arg_name, const char *
}
new_vgid = arg_vgid;
- old_vgid = dm_hash_lookup(s->vgname_to_vgid, arg_name);
+ old_vgid = dm_hash_lookup_str_multival(s->vgname_to_vgid, arg_name, &old_vgid2);
+
+ /*
+ * FIXME: this ensures that arg_name maps to only one existing
+ * VG (old_vgid), because if it maps to multiple vgids, then we
+ * don't know which one should get the new vgid (arg_vgid). If
+ * this function was given both the existing name and existing
+ * vgid to identify the VG, then this wouldn't be a problem.
+ * But as it is now, the vgid arg to this function is the new
+ * vgid and the existing VG is specified only by name.
+ */
+ if (old_vgid && old_vgid2) {
+ ERROR(s, "update_metadata arg_vgid %s arg_name %s found two vgids for name %s %s",
+ arg_vgid, arg_name, old_vgid, old_vgid2);
+ old_vgid = NULL;
+ }
if (!old_vgid) {
/* This shouldn't happen. */
@@ -2633,6 +2693,11 @@ use_name:
if (!(uuid = dm_hash_lookup(s->vgname_to_vgid, name)))
goto out;
+ /*
+ * FIXME: if we only have the name and multiple VGs have that name,
+ * then invalidate each of them.
+ */
+
if (!(vg = dm_hash_lookup(s->vgid_to_metadata, uuid)))
goto out;
vers:
diff --git a/libdm/.exported_symbols.Base b/libdm/.exported_symbols.Base
index 27fef53..30e6a2b 100644
--- a/libdm/.exported_symbols.Base
+++ b/libdm/.exported_symbols.Base
@@ -92,6 +92,10 @@ dm_hash_lookup_binary
dm_hash_remove
dm_hash_remove_binary
dm_hash_wipe
+dm_hash_lookup_str_withval
+dm_hash_lookup_str_multival
+dm_hash_remove_str_withval
+dm_hash_insert_str_multival
dm_is_dm_major
dm_is_empty_dir
dm_lib_exit
diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c
index 30b4a97..cf18226 100644
--- a/libdm/datastruct/hash.c
+++ b/libdm/datastruct/hash.c
@@ -208,6 +208,139 @@ void dm_hash_remove(struct dm_hash_table *t, const char *key)
dm_hash_remove_binary(t, key, strlen(key) + 1);
}
+static struct dm_hash_node **_find_str_withval(struct dm_hash_table *t,
+ const void *key, const void *val,
+ uint32_t len, uint32_t val_len)
+{
+ struct dm_hash_node **c;
+ unsigned h;
+
+ h = _hash(key, len) & (t->num_slots - 1);
+
+ for (c = &t->slots[h]; *c; c = &((*c)->next)) {
+ if ((*c)->keylen != len)
+ continue;
+
+ if (!memcmp(key, (*c)->key, len) && (*c)->data) {
+ char *str = (char *)((*c)->data);
+
+ if (((strlen(str) + 1) == val_len) &&
+ !memcmp(val, str, val_len))
+ return c;
+ }
+ }
+
+ return NULL;
+}
+
+int dm_hash_insert_str_multival(struct dm_hash_table *t, const char *key, const char *val)
+{
+ struct dm_hash_node *n;
+ struct dm_hash_node *first;
+ int len = strlen(key) + 1;
+ unsigned h;
+
+ n = _create_node(key, len);
+ if (!n)
+ return 0;
+
+ n->data = (void *)val;
+
+ h = _hash(key, len) & (t->num_slots - 1);
+
+ first = t->slots[h];
+
+ if (first)
+ n->next = first;
+ else
+ n->next = 0;
+ t->slots[h] = n;
+
+ t->num_nodes++;
+ return 1;
+}
+
+/*
+ * Look through multiple entries with the same key for one that has a
+ * matching val and return that. If none have maching val, return NULL.
+ */
+void *dm_hash_lookup_str_withval(struct dm_hash_table *t, const char *key, const char *val)
+{
+ struct dm_hash_node **c;
+
+ c = _find_str_withval(t, key, val, strlen(key) + 1, strlen(val) + 1);
+
+ return (c && *c) ? (*c)->data : 0;
+}
+
+/*
+ * Look through multiple entries with the same key for one that has a
+ * matching val and remove that.
+ */
+void dm_hash_remove_str_withval(struct dm_hash_table *t, const char *key, const char *val)
+{
+ struct dm_hash_node **c;
+
+ c = _find_str_withval(t, key, val, strlen(key) + 1, strlen(val) + 1);
+
+ if (c && *c) {
+ struct dm_hash_node *old = *c;
+ *c = (*c)->next;
+ dm_free(old);
+ t->num_nodes--;
+ }
+}
+
+/*
+ * Look for multiple entries with the same key.
+ *
+ * If no entries have key, return NULL.
+ *
+ * If one entry has the key, the function returns the val,
+ * and sets val2 to NULL.
+ *
+ * If two entries have the key, the function returns the val
+ * from the first entry, and the val2 arg is set to the val
+ * from the second entry.
+ *
+ * If more than two entries have the key, the function looks
+ * at only the first two.
+ */
+void *dm_hash_lookup_str_multival(struct dm_hash_table *t, const char *key, const char **val2)
+{
+ struct dm_hash_node **c;
+ struct dm_hash_node **c1 = NULL;
+ struct dm_hash_node **c2 = NULL;
+ uint32_t len = strlen(key) + 1;
+ unsigned h;
+
+ h = _hash(key, len) & (t->num_slots - 1);
+
+ for (c = &t->slots[h]; *c; c = &((*c)->next)) {
+ if ((*c)->keylen != len)
+ continue;
+
+ if (!memcmp(key, (*c)->key, len)) {
+ if (!c1) {
+ c1 = c;
+ } else if (!c2) {
+ c2 = c;
+ break;
+ }
+ }
+ }
+
+ if (!c2)
+ *val2 = NULL;
+ else
+ *val2 = (*c2)->data;
+
+ if (!c1)
+ return NULL;
+ else
+ return *c1 ? (*c1)->data : 0;
+}
+
unsigned dm_hash_get_num_entries(struct dm_hash_table *t)
{
return t->num_nodes;
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index f7ab257..de2dc3e 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1849,6 +1849,21 @@ void *dm_hash_get_data(struct dm_hash_table *t, struct dm_hash_node *n);
struct dm_hash_node *dm_hash_get_first(struct dm_hash_table *t);
struct dm_hash_node *dm_hash_get_next(struct dm_hash_table *t, struct dm_hash_node *n);
+/*
+ * Using these requires that string values were inserted.
+ * They support the case where multiple values with the
+ * same key are inserted.
+ *
+ * The "withval" variants ensure that an entry matches
+ * both the specified key and value. They are used to
+ * return or remove a unique entry by specifiying both
+ * the key and the value.
+ */
+int dm_hash_insert_str_multival(struct dm_hash_table *t, const char *key, const char *val);
+void *dm_hash_lookup_str_multival(struct dm_hash_table *t, const char *key, const char **val2);
+void *dm_hash_lookup_str_withval(struct dm_hash_table *t, const char *key, const char *val);
+void dm_hash_remove_str_withval(struct dm_hash_table *t, const char *key, const char *val);
+
#define dm_hash_iterate(v, h) \
for (v = dm_hash_get_first((h)); v; \
v = dm_hash_get_next((h), v))
8 years, 5 months
master - pvmove: Remove unused find_pvmove_lv_from_pvname.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=970a42890905e6...
Commit: 970a42890905e62c43d20b3b4eb0ec7ece0af11c
Parent: b2e13ac552b6209c02c6e2c00aa0db2018135523
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Nov 13 18:06:08 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Nov 13 18:06:08 2015 +0000
pvmove: Remove unused find_pvmove_lv_from_pvname.
---
lib/metadata/metadata-exported.h | 5 -----
lib/metadata/mirror.c | 18 ------------------
2 files changed, 0 insertions(+), 23 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 2d118f4..f009687 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -1185,11 +1185,6 @@ void lv_release_replicator_vgs(const struct logical_volume *lv);
struct logical_volume *find_pvmove_lv(struct volume_group *vg,
struct device *dev, uint64_t lv_type);
-struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd,
- struct volume_group *vg,
- const char *name,
- const char *uuid,
- uint64_t lv_type);
const struct logical_volume *find_pvmove_lv_in_lv(const struct logical_volume *lv);
const char *get_pvmove_pvname_from_lv(const struct logical_volume *lv);
const char *get_pvmove_pvname_from_lv_mirr(const struct logical_volume *lv_mirr);
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index b69acf5..ae7b084 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -1640,24 +1640,6 @@ struct logical_volume *find_pvmove_lv(struct volume_group *vg,
return NULL;
}
-struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd,
- struct volume_group *vg,
- const char *name,
- const char *uuid __attribute__((unused)),
- uint64_t lv_type)
-{
- struct physical_volume *pv;
- struct logical_volume *lv;
-
- if (!(pv = find_pv_by_name(cmd, name, 0, 0)))
- return_NULL;
-
- lv = find_pvmove_lv(vg, pv->dev, lv_type);
- free_pv_fid(pv);
-
- return lv;
-}
-
struct dm_list *lvs_using_lv(struct cmd_context *cmd, struct volume_group *vg,
struct logical_volume *lv)
{
8 years, 5 months