master - lvconvert: use lv_update_and_reload
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ca2ea5f984207c...
Commit: ca2ea5f984207ca9ff8a48bcbb84ca0fc3ee6e72
Parent: f50cef96c651d155ff34b9b2fa7b73b673f528d0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 8 22:48:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 10 21:57:38 2014 +0200
lvconvert: use lv_update_and_reload
Use lib function.
---
tools/lvconvert.c | 55 ++++++----------------------------------------------
1 files changed, 7 insertions(+), 48 deletions(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 185cd59..a04a7fc 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -672,45 +672,6 @@ static struct logical_volume *_get_lvconvert_lv(struct cmd_context *cmd __attrib
return lv;
}
-static int _reload_lv(struct cmd_context *cmd,
- struct volume_group *vg,
- struct logical_volume *lv)
-{
- int r = 0;
-
- log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
-
- if (!vg_write(vg))
- return_0;
-
- if (!suspend_lv(cmd, lv)) {
- log_error("Failed to lock %s", lv->name);
- vg_revert(vg);
- if (!resume_lv(cmd, lv))
- stack;
- goto out;
- }
-
- if (!vg_commit(vg)) {
- vg_revert(vg);
- if (!resume_lv(cmd, lv))
- stack;
- goto_out;
- }
-
- log_very_verbose("Updating \"%s\" in kernel", lv->name);
-
- if (!resume_lv(cmd, lv)) {
- log_error("Problem reactivating %s", lv->name);
- goto out;
- }
-
- r = 1;
- backup(vg);
-out:
- return r;
-}
-
static int _finish_lvconvert_mirror(struct cmd_context *cmd,
struct volume_group *vg,
struct logical_volume *lv,
@@ -726,9 +687,7 @@ static int _finish_lvconvert_mirror(struct cmd_context *cmd,
lv->status &= ~CONVERTING;
- log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
-
- if (!_reload_lv(cmd, vg, lv))
+ if (!lv_update_and_reload(lv))
return_0;
log_print_unless_silent("Logical volume %s converted.", lv->name);
@@ -1207,7 +1166,7 @@ static int _lv_update_log_type(struct cmd_context *cmd,
* mirrored logs in cluster mirrors.
*/
if (old_log_count &&
- !_reload_lv(cmd, log_lv->vg, log_lv))
+ !lv_update_and_reload(log_lv))
return_0;
return 1;
@@ -1572,7 +1531,7 @@ out:
out_skip_log_convert:
- if (!_reload_lv(cmd, lv->vg, lv))
+ if (!lv_update_and_reload(lv))
return_0;
return 1;
@@ -1609,7 +1568,7 @@ int mirror_remove_missing(struct cmd_context *cmd,
!_lv_update_log_type(cmd, NULL, lv, failed_pvs, log_count))
return_0;
- if (!_reload_lv(cmd, lv->vg, lv))
+ if (!lv_update_and_reload(lv))
return_0;
return 1;
@@ -2117,7 +2076,7 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
}
/* store vg on disk(s) */
- if (!_reload_lv(cmd, lv->vg, org))
+ if (!lv_update_and_reload(org))
return_0;
log_print_unless_silent("Logical volume %s converted to snapshot.", lv->name);
@@ -2608,7 +2567,7 @@ static int _lvconvert_thin(struct cmd_context *cmd,
goto revert_new_lv;
}
- if (!_reload_lv(cmd, vg, torigin_lv)) {
+ if (!lv_update_and_reload(torigin_lv)) {
stack;
goto deactivate_and_revert_new_lv;
}
@@ -3057,7 +3016,7 @@ static int _lvconvert_cache(struct cmd_context *cmd,
if (!(cache_lv = lv_cache_create(pool_lv, origin)))
return_0;
- if (!_reload_lv(cmd, cache_lv->vg, cache_lv))
+ if (!lv_update_and_reload(cache_lv))
return_0;
log_print_unless_silent("Logical volume %s is now cached.",
9 years, 6 months
master - lv_manip: remove vg_revert
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f50cef96c651d1...
Commit: f50cef96c651d155ff34b9b2fa7b73b673f528d0
Parent: c61c5f360d00097fcb97ac9d9dec6687cd86e35f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 8 22:39:58 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 10 21:57:38 2014 +0200
lv_manip: remove vg_revert
vg_commit is supposed to have implicit revert handling.
(however as of now it needs fixes).
---
lib/metadata/lv_manip.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 3b158b8..2b00957 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6100,7 +6100,6 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
if (!vg_commit(lv_where->vg)) {
log_error("Failed to commit intermediate VG %s metadata for mirror conversion.", lv_where->vg->name);
- vg_revert(lv_where->vg);
return NULL;
}
9 years, 6 months
master - lv_rename: fix snapshot rename
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c61c5f360d0009...
Commit: c61c5f360d00097fcb97ac9d9dec6687cd86e35f
Parent: 17e8b6aa686958c49b9a4752ea235bbdc99a7643
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 9 18:47:27 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 10 21:57:38 2014 +0200
lv_rename: fix snapshot rename
Fix rename operation for snapshot (cow) LV.
Only the snapshot's origin has the lock and by mistake suspend
and resume has been called for the snapshot LV.
This further made volumes unusable in cluster.
So instead of suspend and resuming list of LVs,
we need to just suspend and resume origin.
As the sequence write/suspend/commit/resume
is widely used in lvm2 code base - move it to
new lv_update_and_reload function.
---
WHATS_NEW | 2 +
lib/metadata/lv_manip.c | 98 ++++++++++++++++++++++----------------
lib/metadata/metadata-exported.h | 4 ++
3 files changed, 63 insertions(+), 41 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index bf929f6..2175d29 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.02.112 -
=====================================
+ Introduce common code to modify metadate and reload updated LV.
+ Fix rename of active snapshot volume in cluster.
Make sure shared libraries are built with RELRO option.
Version 2.02.111 - 1st September 2014
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 60aa6f8..3b158b8 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3940,10 +3940,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
const char *new_name, int update_mda)
{
struct volume_group *vg = lv->vg;
- struct lv_names lv_names;
- DM_LIST_INIT(lvs_changed);
- struct lv_list lvl, lvl2, *lvlp;
- int r = 0;
+ struct lv_names lv_names = { .old = lv->name };
/* rename is not allowed on sub LVs */
if (!lv_is_visible(lv)) {
@@ -3965,51 +3962,25 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
if (update_mda && !archive(vg))
return_0;
+ if (!(lv_names.new = dm_pool_strdup(cmd->mem, new_name))) {
+ log_error("Failed to allocate space for new name.");
+ return 0;
+ }
+
/* rename sub LVs */
- lv_names.old = lv->name;
- lv_names.new = new_name;
if (!for_each_sub_lv(lv, _rename_cb, (void *) &lv_names))
return_0;
/* rename main LV */
- if (!(lv->name = dm_pool_strdup(cmd->mem, new_name))) {
- log_error("Failed to allocate space for new name");
- return 0;
- }
-
- if (!update_mda)
- return 1;
+ lv->name = lv_names.new;
- lvl.lv = lv;
- dm_list_add(&lvs_changed, &lvl.list);
+ if (lv_is_cow(lv))
+ lv = origin_from_cow(lv);
- /* rename active virtual origin too */
- if (lv_is_cow(lv) && lv_is_virtual_origin(lvl2.lv = origin_from_cow(lv)))
- dm_list_add_h(&lvs_changed, &lvl2.list);
-
- log_verbose("Writing out updated volume group");
- if (!vg_write(vg))
- return 0;
-
- if (!suspend_lvs(cmd, &lvs_changed, vg))
- goto_out;
-
- if (!(r = vg_commit(vg)))
- stack;
+ if (update_mda && !lv_update_and_reload(lv))
+ return_0;
- /*
- * FIXME: resume LVs in reverse order to prevent memory
- * lock imbalance when resuming virtual snapshot origin
- * (resume of snapshot resumes origin too)
- */
- dm_list_iterate_back_items(lvlp, &lvs_changed)
- if (!resume_lv(cmd, lvlp->lv)) {
- r = 0;
- stack;
- }
-out:
- backup(vg);
- return r;
+ return 1;
}
/*
@@ -5739,6 +5710,51 @@ no_remove:
return 0;
}
+static int _lv_update_and_reload(struct logical_volume *lv, int origin_only)
+{
+ struct volume_group *vg = lv->vg;
+ int do_backup = 0, r = 0;
+
+ log_very_verbose("Updating logical volume %s on disk(s).",
+ display_lvname(lv));
+
+ if (!vg_write(vg))
+ return_0;
+
+ if (!(origin_only ? suspend_lv_origin(vg->cmd, lv) : suspend_lv(vg->cmd, lv))) {
+ log_error("Failed to lock logical volume %s.",
+ display_lvname(lv));
+ vg_revert(vg);
+ } else if (!(r = vg_commit(vg)))
+ stack; /* !vg_commit() has implict vg_revert() */
+ else
+ do_backup = 1;
+
+ log_very_verbose("Updating logical volume %s in kernel.",
+ display_lvname(lv));
+
+ if (!(origin_only ? resume_lv_origin(vg->cmd, lv) : resume_lv(vg->cmd, lv))) {
+ log_error("Problem reactivating logical volume %s.",
+ display_lvname(lv));
+ r = 0;
+ }
+
+ if (do_backup)
+ backup(vg);
+
+ return r;
+}
+
+int lv_update_and_reload(struct logical_volume *lv)
+{
+ return _lv_update_and_reload(lv, 0);
+}
+
+int lv_update_and_reload_origin(struct logical_volume *lv)
+{
+ return _lv_update_and_reload(lv, 1);
+}
+
/*
* insert_layer_for_segments_on_pv() inserts a layer segment for a segment area.
* However, layer modification could split the underlying layer segment.
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 0db4334..b0ca632 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -700,6 +700,10 @@ int lv_rename(struct cmd_context *cmd, struct logical_volume *lv,
int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
const char *new_name, int update_mda);
+/* Updates and reloads metadata for given lv */
+int lv_update_and_reload(struct logical_volume *lv);
+int lv_update_and_reload_origin(struct logical_volume *lv);
+
uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size,
uint32_t extent_size);
9 years, 6 months
master - cleanup: add stacktrace for error path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=17e8b6aa686958...
Commit: 17e8b6aa686958c49b9a4752ea235bbdc99a7643
Parent: 4f1af9b99a0fb0824d8ab6b3b4c9ed3c61e89ee4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 8 22:36:42 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 10 20:06:20 2014 +0200
cleanup: add stacktrace for error path
---
lib/metadata/lv_manip.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index fcf9975..60aa6f8 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -3963,13 +3963,13 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
}
if (update_mda && !archive(vg))
- return 0;
+ return_0;
/* rename sub LVs */
lv_names.old = lv->name;
lv_names.new = new_name;
if (!for_each_sub_lv(lv, _rename_cb, (void *) &lv_names))
- return 0;
+ return_0;
/* rename main LV */
if (!(lv->name = dm_pool_strdup(cmd->mem, new_name))) {
9 years, 6 months
master - lvmetad: Differentiate between filtered and truly missing devices.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4f1af9b99a0fb0...
Commit: 4f1af9b99a0fb0824d8ab6b3b4c9ed3c61e89ee4
Parent: 1639bd2847ffc53352d8f74304403176b3807806
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Sep 10 12:45:52 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Sep 10 12:48:14 2014 +0200
lvmetad: Differentiate between filtered and truly missing devices.
We used to print an error message whenever we tried to deal with devices that
lvmetad knew about but were rejected by a client-side filter. Instead, we now
check whether the device is actually absent or only filtered out and only print
a warning in the latter case.
---
lib/cache/lvmetad.c | 6 +++++-
test/shell/lvmetad-client-filter.sh | 18 ++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 7896ddd..ef1d01a 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -293,7 +293,11 @@ static struct lvmcache_info *_pv_populate_lvmcache(struct cmd_context *cmd,
dev = dev_cache_get_by_devt(fallback, cmd->filter);
if (!dev) {
- log_error("No device found for PV %s.", pvid_txt);
+ dev = dev_cache_get_by_devt(devt, cmd->lvmetad_filter);
+ if (!dev)
+ log_error("No device found for PV %s.", pvid_txt);
+ else
+ log_warn("WARNING: Device %s for PV %s rejected by a filter.", dev_name(dev), pvid_txt);
return NULL;
}
diff --git a/test/shell/lvmetad-client-filter.sh b/test/shell/lvmetad-client-filter.sh
new file mode 100644
index 0000000..3002a47
--- /dev/null
+++ b/test/shell/lvmetad-client-filter.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+# Copyright (C) 2014 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
+
+. lib/inittest
+
+test -e LOCAL_LVMETAD || skip
+aux prepare_pvs 2
+
+pvs --config 'devices { filter = [ "r%.*%" ] }' 2>&1 | grep rejected
+pvs --config 'devices { filter = [ "r%.*%" ] }' 2>&1 | not grep 'No device found'
9 years, 6 months
master - test: Add a test for MD component detection in pvscan --cache.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1639bd2847ffc5...
Commit: 1639bd2847ffc53352d8f74304403176b3807806
Parent: 3685a51679e03ecd494063601161992dbe3bff22
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Tue Sep 9 17:25:29 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Tue Sep 9 17:25:29 2014 +0200
test: Add a test for MD component detection in pvscan --cache.
---
test/shell/lvmetad-pvscan-md.sh | 77 +++++++++++++++++++++++++++++++++++++++
1 files changed, 77 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvmetad-pvscan-md.sh b/test/shell/lvmetad-pvscan-md.sh
new file mode 100644
index 0000000..dd85bb6
--- /dev/null
+++ b/test/shell/lvmetad-pvscan-md.sh
@@ -0,0 +1,77 @@
+#!/bin/sh
+# Copyright (C) 2014 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
+
+. lib/inittest
+
+test -e LOCAL_LVMETAD || skip
+which mdadm || skip
+
+test -f /proc/mdstat && grep -q raid0 /proc/mdstat || \
+ modprobe raid0 || skip
+
+aux lvmconf 'devices/md_component_detection = 1'
+aux extend_filter_LVMTEST
+aux extend_filter "a|/dev/md.*|"
+
+aux prepare_devs 2
+
+# TODO factor out the following MD-creation code into lib/
+
+# Have MD use a non-standard name to avoid colliding with an existing MD device
+# - mdadm >= 3.0 requires that non-standard device names be in /dev/md/
+# - newer mdadm _completely_ defers to udev to create the associated device node
+mdadm_maj=$(mdadm --version 2>&1 | perl -pi -e 's|.* v(\d+).*|\1|')
+[ $mdadm_maj -ge 3 ] && \
+ mddev=/dev/md/md_lvm_test0 || \
+ mddev=/dev/md_lvm_test0
+
+cleanup_md() {
+ # sleeps offer hack to defeat: 'md: md127 still in use'
+ # see: https://bugzilla.redhat.com/show_bug.cgi?id=509908#c25
+ aux udev_wait
+ mdadm --stop "$mddev" || true
+ aux udev_wait
+ if [ -b "$mddev" ]; then
+ # mdadm doesn't always cleanup the device node
+ sleep 2
+ rm -f "$mddev"
+ fi
+}
+
+cleanup_md_and_teardown() {
+ cleanup_md
+ aux teardown
+}
+
+# create 2 disk MD raid0 array (stripe_width=128K)
+test -b "$mddev" && skip
+mdadm --create --metadata=1.0 "$mddev" --auto=md --level 0 --raid-devices=2 --chunk 64 "$dev1" "$dev2"
+trap 'cleanup_md_and_teardown' EXIT # cleanup this MD device at the end of the test
+test -b "$mddev" || skip
+cp -LR "$mddev" "$DM_DEV_DIR" # so that LVM/DM can see the device
+lvmdev="$DM_DEV_DIR/md_lvm_test0"
+
+# TODO end MD-creation code
+
+# maj=$(($(stat -L --printf=0x%t "$dev2")))
+# min=$(($(stat -L --printf=0x%T "$dev2")))
+
+pvcreate $lvmdev
+
+pvscan --cache "$lvmdev"
+
+# ensure that lvmetad can only see the toplevel MD device
+not pvscan --cache "$dev1" 2>&1 | grep "not found"
+not pvscan --cache "$dev2" 2>&1 | grep "not found"
+
+pvs | grep $lvmdev
+pvs | not grep $dev1
+pvs | not grep $dev2
9 years, 6 months
master - lvmetad: Re-organise filters to properly avoid scans of component devices.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3685a51679e03e...
Commit: 3685a51679e03ecd494063601161992dbe3bff22
Parent: 66cce64e6985f7f1614c6bde618c7a4207fea7e9
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Tue Sep 9 17:16:40 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Tue Sep 9 17:16:40 2014 +0200
lvmetad: Re-organise filters to properly avoid scans of component devices.
If a PV label is exposed both through a composite device (MD for example) and
through its component devices, we always want the PV that lvmetad sees to be the
composite, since this is what all LVM commands (including activation) will then
use. If pvscan --cache is triggered for multiple clones of the same PV, the last
to finish wins. This patch basically re-arranges the filters so that
component-device filters are part of the global_filter chain, not of the
client-side filter chain. This has a subtle effect on filter evaluation order,
but should not alter visible semantics in the non-lvmetad case.
---
lib/commands/toolcontext.c | 47 +++++++++++++++++++++----------------------
1 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index fe79a81..5bf5cbf 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -861,11 +861,9 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
}
/* regex filter. Optional. */
- if (!(cn = find_config_tree_node(cmd, devices_filter_CFG, NULL)))
- log_very_verbose("devices/filter not found in config file: "
- "no regex filter installed");
- else if (!(filters[nr_filt] = regex_filter_create(cn->v))) {
- log_error("Failed to create regex device filter");
+ if ((cn = find_config_tree_node(cmd, devices_global_filter_CFG, NULL)) &&
+ !(filters[nr_filt] = regex_filter_create(cn->v))) {
+ log_error("Failed to create global regex device filter");
goto bad;
} else
nr_filt++;
@@ -918,16 +916,26 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
cmd->dump_filter = 0;
- if (!(f3 = _init_filter_components(cmd)))
+ if (!(cmd->lvmetad_filter = _init_filter_components(cmd)))
goto_bad;
init_ignore_suspended_devices(find_config_tree_bool(cmd, devices_ignore_suspended_devices_CFG, NULL));
init_ignore_lvm_mirrors(find_config_tree_bool(cmd, devices_ignore_lvm_mirrors_CFG, NULL));
+ if ((cn = find_config_tree_node(cmd, devices_filter_CFG, NULL))) {
+ if (!(f3 = regex_filter_create(cn->v)))
+ goto_bad;
+ toplevel_components[0] = cmd->lvmetad_filter;
+ toplevel_components[1] = f3;
+ if (!(f4 = composite_filter_create(2, toplevel_components)))
+ goto_bad;
+ } else
+ f4 = cmd->lvmetad_filter;
+
if (!(dev_cache = find_config_tree_str(cmd, devices_cache_CFG, NULL)))
goto_bad;
- if (!(f4 = persistent_filter_create(cmd->dev_types, f3, dev_cache))) {
+ if (!(cmd->filter = persistent_filter_create(cmd->dev_types, f4, dev_cache))) {
log_verbose("Failed to create persistent device filter.");
goto bad;
}
@@ -948,29 +956,20 @@ static int _init_filters(struct cmd_context *cmd, unsigned load_persistent_cache
load_persistent_cache && !cmd->is_long_lived &&
!stat(dev_cache, &st) &&
(st.st_ctime > config_file_timestamp(cmd->cft)) &&
- !persistent_filter_load(f4, NULL))
+ !persistent_filter_load(cmd->filter, NULL))
log_verbose("Failed to load existing device cache from %s",
dev_cache);
- if (!(cn = find_config_tree_node(cmd, devices_global_filter_CFG, NULL))) {
- cmd->filter = f4;
- } else if (!(cmd->lvmetad_filter = regex_filter_create(cn->v)))
- goto_bad;
- else {
- toplevel_components[0] = cmd->lvmetad_filter;
- toplevel_components[1] = f4;
- if (!(cmd->filter = composite_filter_create(2, toplevel_components)))
- goto_bad;
- }
-
return 1;
bad:
- if (f4)
+ if (f4) /* kills both f3 and cmd->lvmetad_filter */
f4->destroy(f4);
- else if (f3)
- f3->destroy(f3);
- if (toplevel_components[0])
- toplevel_components[0]->destroy(toplevel_components[0]);
+ else {
+ if (f3)
+ f3->destroy(f3);
+ if (cmd->lvmetad_filter)
+ cmd->lvmetad_filter->destroy(cmd->lvmetad_filter);
+ }
return 0;
}
9 years, 6 months
master - dev-cache: Filter wipe does not guarantee a full /dev scan.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=66cce64e6985f7...
Commit: 66cce64e6985f7f1614c6bde618c7a4207fea7e9
Parent: c774d9a3f35c312d5b24c4ba13da707ccd975194
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Tue Sep 9 17:14:35 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Tue Sep 9 17:14:35 2014 +0200
dev-cache: Filter wipe does not guarantee a full /dev scan.
The code in dev_iter_create assumes that if a filter can be wiped, doing so will
always trigger a call to _full_scan. This is not true for composite filters
though, since they can always be wiped in principle, but there is no way to know
that a component filter inside will exist that actually triggers the scan.
---
lib/device/dev-cache.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 1d7a517..ba4ee54 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1009,9 +1009,11 @@ struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan)
if (dev_scan && !trust_cache()) {
/* Flag gets reset between each command */
if (!full_scan_done()) {
- if (f && f->wipe)
- f->wipe(f); /* Calls _full_scan(1) */
- else
+ if (f && f->wipe) {
+ f->wipe(f); /* might call _full_scan(1) */
+ if (!full_scan_done())
+ _full_scan(1);
+ } else
_full_scan(1);
}
} else
9 years, 6 months
master - debug: turn message into debug
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=47ff145e08f689...
Commit: 47ff145e08f689306762840efd72e8a4e1c91214
Parent: 55aa3cc813620ecbf2f569720fb24107e737b836
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Sep 10 10:10:13 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Sep 10 10:10:13 2014 +0200
debug: turn message into debug
This message should be printed only for activation commands,
however since the handling of this flag is not correct
(rhbz 1140029) and will require further changes,
do now just a minor change and switch message into log_debug
(so it's not printed i.e. with every 'lvs -v')
---
tools/lvmcmdline.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 10dac8f..14ea7a6 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1343,7 +1343,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
goto_out;
_apply_settings(cmd);
if (cmd->degraded_activation)
- log_verbose("DEGRADED MODE. Incomplete RAID LVs will be processed.");
+ log_debug("DEGRADED MODE. Incomplete RAID LVs will be processed.");
if (!get_activation_monitoring_mode(cmd, &monitoring))
goto_out;
9 years, 6 months
master - tests: test for rename of snapshot
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=55aa3cc813620e...
Commit: 55aa3cc813620ecbf2f569720fb24107e737b836
Parent: a86d9a3b305be466d221f2a5e210bc1cad8fe842
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 9 20:17:47 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 9 20:17:47 2014 +0200
tests: test for rename of snapshot
---
test/shell/snapshot-cluster.sh | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/test/shell/snapshot-cluster.sh b/test/shell/snapshot-cluster.sh
new file mode 100644
index 0000000..051c165
--- /dev/null
+++ b/test/shell/snapshot-cluster.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+# Copyright (C) 2014 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
+
+# Testing renaming snapshots in cluster
+# https://bugzilla.redhat.com/show_bug.cgi?id=1136925
+
+. lib/inittest
+
+aux prepare_vg 1
+
+lvcreate -aey -L1 -n $lv1 $vg
+lvcreate -s -L1 -n $lv2 $vg/$lv1
+lvrename $vg/$lv2 $vg/$lv3
+lvremove -f $vg/$lv1
+
+vgremove -f $vg
9 years, 6 months