From 9b02bdbce0c661b78eb1ad42423771a71d27ffc2 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 3 Oct 2005 21:10:41 +0000 Subject: Refuse to run pvcreate/pvremove on devices we can't open exclusively. --- tools/pvremove.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools/pvremove.c') 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); -- cgit