summaryrefslogtreecommitdiffstats
path: root/tools/pvremove.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2005-10-03 21:10:41 +0000
committerAlasdair Kergon <agk@redhat.com>2005-10-03 21:10:41 +0000
commit9b02bdbce0c661b78eb1ad42423771a71d27ffc2 (patch)
tree0a58dca8e1151eebe0a01c9117badee865abc57b /tools/pvremove.c
parent9c9e30cd6d97089aa7ee6e16c553edc7c3a43988 (diff)
downloadlvm2-9b02bdbce0c661b78eb1ad42423771a71d27ffc2.tar.gz
lvm2-9b02bdbce0c661b78eb1ad42423771a71d27ffc2.tar.xz
lvm2-9b02bdbce0c661b78eb1ad42423771a71d27ffc2.zip
Refuse to run pvcreate/pvremove on devices we can't open exclusively.
Diffstat (limited to 'tools/pvremove.c')
-rw-r--r--tools/pvremove.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/pvremove.c b/tools/pvremove.c
index 6fd9daa0..1fce587a 100644
--- a/tools/pvremove.c
+++ b/tools/pvremove.c
@@ -86,6 +86,12 @@ static int pvremove_single(struct cmd_context *cmd, const char *pv_name,
goto error;
}
+ if (!dev_test_excl(dev)) {
+ log_error("Can't open %s exclusively. Mounted filesystem?",
+ dev_name(dev));
+ return 0;
+ }
+
/* Wipe existing label(s) */
if (!label_remove(dev)) {
log_error("Failed to wipe existing label(s) on %s", pv_name);