All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix pvcreate device check.
@ 2010-03-15 13:14 Milan Broz
  2010-03-15 13:18 ` Milan Broz
  0 siblings, 1 reply; 3+ messages in thread
From: Milan Broz @ 2010-03-15 13:14 UTC (permalink / raw)
  To: lvm-devel

If user try to vgcreate or vgextend non-existent VG,
these messages appears:

# vgcreate xxx /dev/xxx
  Internal error: Volume Group xxx was not unlocked
  Device /dev/xxx not found (or ignored by filtering).
  Unable to add physical volume '/dev/xxx' to volume group 'xxx'.
  Internal error: Attempt to unlock unlocked VG xxx.

(the same with existing VG and non-existing PV & vgextend)
# vgextend vg_test /dev/xxx
...

It is caused because code tries to "refresh" cache if
md filter is switched on using cache destroy.

But we can change filters and rescan even without this
machinery now, just use refresh_filters
(and reset md filter afterwards).

(Patch also  discovers cache alias bug in vgsplit test,
fix it by using better filter line.)

Signed-off-by: Milan Broz <mbroz@redhat.com>
---
 lib/metadata/metadata.c   |   12 ++----------
 test/t-vgsplit-stacked.sh |    2 +-
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index f1b90a7..f079554 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -1294,17 +1294,9 @@ static int pvcreate_check(struct cmd_context *cmd, const char *name,
 
 	/* Is there an md superblock here? */
 	if (!dev && md_filtering()) {
-		unlock_vg(cmd, VG_ORPHANS);
-
-		persistent_filter_wipe(cmd->filter);
-		lvmcache_destroy(cmd, 1);
-
+		refresh_filters(cmd);
 		init_md_filtering(0);
-		if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {
-			log_error("Can't get lock for orphan PVs");
-			init_md_filtering(1);
-			return 0;
-		}
+		lvmcache_label_scan(cmd, 0);
 		dev = dev_cache_get(name, cmd->filter);
 		init_md_filtering(1);
 	}
diff --git a/test/t-vgsplit-stacked.sh b/test/t-vgsplit-stacked.sh
index 46cb105..fb4e659 100644
--- a/test/t-vgsplit-stacked.sh
+++ b/test/t-vgsplit-stacked.sh
@@ -1,6 +1,6 @@
 . ./test-utils.sh
 
-prepare_lvmconf '[ "a/dev\/mirror/", "a/dev\/mapper\/.*$/", "r/.*/" ]'
+prepare_lvmconf '[ "a/dev\/mirror/", "a/dev\/mapper\/.*$/", "a/dev\/LVMTEST/", "r/.*/" ]'
 aux prepare_devs 3
 
 pvcreate $devs
-- 
1.7.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-16 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-15 13:14 [PATCH] Fix pvcreate device check Milan Broz
2010-03-15 13:18 ` Milan Broz
2010-03-16 22:20   ` Dave Wysochanski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.