Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2f260c99096c9db4…
Commit: 2f260c99096c9db4aa6c3d3623739d18c203e1b4
Parent: 1824a781db2dcdb328ba61893a1ace192cb78775
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Jun 9 10:58:57 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Jun 10 10:51:24 2014 +0200
activation: retry cleanup deactivation
Enable 'retry' deactivation also in 'cleanup' phase.
It shouldn't be mostly needed - however udev now produces
more and more completelny non-synchronizable device opens,
so even for orphan devices we can't easily predict where
udevd opens devices.
So it's more preferable here to log error about device being open
and retry clean, but let the command proceed.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 2 ++
2 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 65cac33..4310dd1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
+ Use retry_deactivation also when cleaning orphan devices.
Prompt when setting the VG cluster attr if the cluster is not setup.
Allow --yes to skip prompt in vgextend (worked only with -f).
Don't use name mangling for LVM - it never uses dm names with wrong char set.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index cfceab5..22b13ec 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -2816,6 +2816,8 @@ static int _tree_action(struct dev_manager *dm, struct logical_volume *lv,
/* Only process nodes with uuid of "LVM-" plus VG id. */
switch(action) {
case CLEAN:
+ if (retry_deactivation())
+ dm_tree_retry_remove(root);
/* Deactivate any unused non-toplevel nodes */
if (!_clean_tree(dm, root, laopts->origin_only ? dlid : NULL))
goto_out;
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ee200ddfc376bbfb…
Commit: ee200ddfc376bbfb332439f64ced54ce450535dd
Parent: 02e1bf406b2fc9731b2f67c273acd8f21df64714
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sun Jun 8 22:57:04 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Sun Jun 8 22:57:04 2014 +0200
pvremove: Update lvmcache => avoid spurious error messages.
---
lib/cache/lvmcache.c | 5 ++---
lib/metadata/pv_manip.c | 6 ++++++
test/shell/pvremove-warnings.sh | 16 ++++++++++++++++
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index c61bb77..3244205 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1062,7 +1062,6 @@ static int _drop_vginfo(struct lvmcache_info *info, struct lvmcache_vginfo *vgin
return 1;
}
-/* Unused
void lvmcache_del(struct lvmcache_info *info)
{
if (info->dev->pvid[0] && _pvid_hash)
@@ -1071,11 +1070,11 @@ void lvmcache_del(struct lvmcache_info *info)
_drop_vginfo(info, info->vginfo);
info->label->labeller->ops->destroy_label(info->label->labeller,
- info->label);
+ info->label);
dm_free(info);
return;
-} */
+}
static int _lvmcache_update_pvid(struct lvmcache_info *info, const char *pvid)
{
diff --git a/lib/metadata/pv_manip.c b/lib/metadata/pv_manip.c
index 3613515..2717031 100644
--- a/lib/metadata/pv_manip.c
+++ b/lib/metadata/pv_manip.c
@@ -733,6 +733,7 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,
unsigned prompt)
{
struct device *dev;
+ struct lvmcache_info *info;
int r = 0;
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
@@ -749,6 +750,8 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,
goto out;
}
+ info = lvmcache_info_from_pvid(dev->pvid, 1);
+
if (!dev_test_excl(dev)) {
/* FIXME Detect whether device-mapper is still using the device */
log_error("Can't open %s exclusively - not removing. "
@@ -762,6 +765,9 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,
goto out;
}
+ if (info)
+ lvmcache_del(info);
+
if (!lvmetad_pv_gone_by_dev(dev, NULL))
goto_out;
diff --git a/test/shell/pvremove-warnings.sh b/test/shell/pvremove-warnings.sh
new file mode 100644
index 0000000..c9b7c6a
--- /dev/null
+++ b/test/shell/pvremove-warnings.sh
@@ -0,0 +1,16 @@
+# 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/test
+
+aux prepare_devs 2
+pvcreate "$dev1" "$dev2"
+pvremove "$dev1" "$dev2" 2>&1 | tee pvremove.txt
+not grep "No physical" pvremove.txt