From 77fcc2076ac2f20a072e393d0617af3e12c52ca5 Mon Sep 17 00:00:00 2001 From: Patrick Caulfield Date: Mon, 23 Oct 2006 11:46:16 +0000 Subject: [PATCH] Don't allow a node to remove an LV that's exclusively active on anther node. --- WHATS_NEW | 1 + tools/lvremove.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 5a5e2e5cd..cc5cfc954 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.13 - =================================== + Don't allow a node to remove an LV that's exclusively active on anther node. Cope if same PV is included more than once in cmdline PE range list. Set PV size to current device size if it is found to be zero. Add segment parameter to target_present functions. diff --git a/tools/lvremove.c b/tools/lvremove.c index cd3b36b25..272fabc82 100644 --- a/tools/lvremove.c +++ b/tools/lvremove.c @@ -75,6 +75,16 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv, if (!archive(vg)) return ECMD_FAILED; + /* If the VG is clustered then make sure no-one else is using the LV + we are about to remove */ + if (vg->status & CLUSTERED) { + if (!activate_lv_excl(cmd, lv)) { + log_error("Can't get exclusive access to volume \"%s\"", + lv->name); + return ECMD_FAILED; + } + } + /* FIXME Snapshot commit out of sequence if it fails after here? */ if (!deactivate_lv(cmd, lv)) { log_error("Unable to deactivate logical volume \"%s\"",