summaryrefslogtreecommitdiffstats
path: root/tools/lvremove.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2002-03-05 20:03:09 +0000
committerAlasdair Kergon <agk@redhat.com>2002-03-05 20:03:09 +0000
commit15c325f06aa0dad2145abf217af4fa082c214e36 (patch)
tree8737373bb3b3b7000b2e568f7ac9dabe73a82128 /tools/lvremove.c
parent2731508b34b858e8204cb67b5f2b2f3780e9b3eb (diff)
downloadlvm2-15c325f06aa0dad2145abf217af4fa082c214e36.tar.gz
lvm2-15c325f06aa0dad2145abf217af4fa082c214e36.tar.xz
lvm2-15c325f06aa0dad2145abf217af4fa082c214e36.zip
o Use new LCK_HOLD flag to indicate whether lock should be held on return
from lock_vol() - otherwise it now attempts to acquire the lock and then immediately releases it. o Extend the id field in struct logical_volume to hold VG uuid + LV uuid for format1. This unique lvid can be used directly when calling lock_vol(). o Add the VG uuid to vgcache to make VG uuid lookups possible. (Another step towards using them instead of VG names internally.)
Diffstat (limited to 'tools/lvremove.c')
-rw-r--r--tools/lvremove.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/tools/lvremove.c b/tools/lvremove.c
index 0b7afbde..2f46e9e2 100644
--- a/tools/lvremove.c
+++ b/tools/lvremove.c
@@ -36,7 +36,6 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv)
{
struct volume_group *vg;
int active;
- char lvidbuf[128];
vg = lv->vg;
@@ -56,7 +55,7 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv)
return ECMD_FAILED;
}
- active = lv_active(lv);
+ active = (lv_active(lv) > 0);
if (active && !arg_count(cmd, force_ARG)) {
if (yes_no_prompt("Do you really want to remove active "
@@ -68,22 +67,21 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv)
}
}
- if (!lvid(lv, lvidbuf, sizeof(lvidbuf)))
- return 0;
-
if (!archive(vg))
return ECMD_FAILED;
- if (!lock_vol(cmd, lvidbuf, LCK_LV_DEACTIVATE)) {
+ if (!lock_vol(cmd, lv->lvid.s, LCK_LV_DEACTIVATE)) {
log_error("Unable to deactivate logical volume \"%s\"",
lv->name);
return ECMD_FAILED;
}
- log_verbose("Removing snapshot.");
- if (lv_is_cow(lv) && !vg_remove_snapshot(lv->vg, lv)) {
- stack;
- return ECMD_FAILED;
+ if (lv_is_cow(lv)) {
+ log_verbose("Removing snapshot %s", lv->name);
+ if (!vg_remove_snapshot(lv->vg, lv)) {
+ stack;
+ return ECMD_FAILED;
+ }
}
log_verbose("Releasing logical volume \"%s\"", lv->name);
@@ -98,8 +96,6 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv)
backup(vg);
- lock_vol(cmd, lvidbuf, LCK_LV_UNLOCK);
-
log_print("Logical volume \"%s\" successfully removed", lv->name);
return 0;
}