summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2012-09-19 12:48:56 +0100
committerAlasdair G Kergon <agk@redhat.com>2012-09-19 12:48:56 +0100
commitb737ff01e4038d45798521448dc4ae4864d1b29a (patch)
treeb42bd437fae56575cb1836684b5d990e8f0e9363 /tools
parent2a6712ddefb6720d115d11c276223b57abf5dd94 (diff)
downloadlvm2-b737ff01e4038d45798521448dc4ae4864d1b29a.tar.gz
lvm2-b737ff01e4038d45798521448dc4ae4864d1b29a.tar.xz
lvm2-b737ff01e4038d45798521448dc4ae4864d1b29a.zip
discards: skip when removing LVs on missing PVs
Don't try to issue discards to a missing PV to avoid segfault. Prevent lvremove from removing LVs that have any part missing. https://bugzilla.redhat.com/857554
Diffstat (limited to 'tools')
-rw-r--r--tools/lvremove.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/lvremove.c b/tools/lvremove.c
index 02521495..2c5b317d 100644
--- a/tools/lvremove.c
+++ b/tools/lvremove.c
@@ -26,6 +26,12 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv,
if (lv_is_cow(lv) && lv_is_virtual_origin(origin = origin_from_cow(lv)))
lv = origin;
+ if (lv->status & PARTIAL_LV) {
+ log_error("Not removing LV %s/%s because part or all of it is missing.",
+ lv->vg->name, lv->name);
+ return ECMD_FAILED;
+ }
+
if (!lv_remove_with_dependencies(cmd, lv, arg_count(cmd, force_ARG), 0)) {
stack;
return ECMD_FAILED;