1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-31 14:50:37 +03:00

o activate/reactivate merge

o unlocking macro
This commit is contained in:
Alasdair Kergon 2002-03-11 15:08:39 +00:00
parent c4ab7d2dbd
commit 427899ddce
16 changed files with 83 additions and 112 deletions

View File

@ -112,25 +112,8 @@ int lv_open_count(struct logical_volume *lv)
return info.open_count;
}
int lv_activate(struct logical_volume *lv)
{
int r;
struct dev_manager *dm;
if (!(dm = dev_manager_create(lv->vg->name))) {
stack;
return 0;
}
if (!(r = dev_manager_activate(dm, lv)))
stack;
dev_manager_destroy(dm);
return r;
}
/* FIXME Need to detect and handle an lv rename */
int lv_reactivate(struct logical_volume *lv)
static int _lv_activate(struct logical_volume *lv)
{
int r;
struct dev_manager *dm;
@ -147,7 +130,7 @@ int lv_reactivate(struct logical_volume *lv)
return r;
}
int lv_deactivate(struct logical_volume *lv)
static int _lv_deactivate(struct logical_volume *lv)
{
int r;
struct dev_manager *dm;
@ -164,7 +147,7 @@ int lv_deactivate(struct logical_volume *lv)
return r;
}
int lv_suspend(struct logical_volume *lv)
static int _lv_suspend(struct logical_volume *lv)
{
#if 0
char buffer[128];
@ -308,8 +291,6 @@ static struct logical_volume *_lv_from_lvid(struct cmd_context *cmd,
return lvl->lv;
}
/* These functions should become the new interface and the _if_active
* bits then disappear */
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s)
{
struct logical_volume *lv;
@ -318,7 +299,7 @@ int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s)
return 0;
if (lv_active(lv) > 0)
lv_suspend(lv);
_lv_suspend(lv);
return 1;
}
@ -332,12 +313,12 @@ int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s)
return 0;
if ((lv_active(lv) > 0) && lv_suspended(lv))
lv_reactivate(lv);
_lv_activate(lv);
return 1;
}
int lv_deactivate_if_active(struct cmd_context *cmd, const char *lvid_s)
int lv_deactivate(struct cmd_context *cmd, const char *lvid_s)
{
struct logical_volume *lv;
@ -345,12 +326,12 @@ int lv_deactivate_if_active(struct cmd_context *cmd, const char *lvid_s)
return 0;
if (lv_active(lv) > 0)
lv_deactivate(lv);
_lv_deactivate(lv);
return 1;
}
int lv_activate_if_inactive(struct cmd_context *cmd, const char *lvid_s)
int lv_activate(struct cmd_context *cmd, const char *lvid_s)
{
struct logical_volume *lv;
int active;
@ -360,10 +341,8 @@ int lv_activate_if_inactive(struct cmd_context *cmd, const char *lvid_s)
active = lv_active(lv);
if ((active > 0) && lv_suspended(lv)) {
lv_reactivate(lv);
} else if (!active)
lv_activate(lv);
if (!active || ((active > 0) && lv_suspended(lv)))
_lv_activate(lv);
return 1;
}

View File

@ -28,22 +28,17 @@ int lv_info(struct logical_volume *lv, struct dm_info *info);
/*
* Activation proper.
*/
int lv_activate(struct logical_volume *lv);
int lv_reactivate(struct logical_volume *lv);
int lv_deactivate(struct logical_volume *lv);
int lv_suspend(struct logical_volume *lv);
int lv_rename(const char *old_name, struct logical_volume *lv);
/*
* These should eventually replace some of the above and maybe
* use config file to determine whether or not to activate
*/
int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s);
int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s);
int lv_activate_if_inactive(struct cmd_context *cmd, const char *lvid_s);
int lv_deactivate_if_active(struct cmd_context *cmd, const char *lvid_s);
int lv_activate(struct cmd_context *cmd, const char *lvid_s);
int lv_deactivate(struct cmd_context *cmd, const char *lvid_s);
/*

View File

@ -167,7 +167,7 @@ int lock_resource(struct cmd_context *cmd, const char *resource, int flags)
return 0;
break;
case LCK_READ:
if (!lv_activate_if_inactive(cmd, resource))
if (!lv_activate(cmd, resource))
return 0;
break;
case LCK_WRITE:
@ -175,7 +175,7 @@ int lock_resource(struct cmd_context *cmd, const char *resource, int flags)
return 0;
break;
case LCK_EXCL:
if (!lv_deactivate_if_active(cmd, resource))
if (!lv_deactivate(cmd, resource))
return 0;
break;
default:

View File

@ -20,13 +20,7 @@ void fin_locking(void);
*
* LCK_LV:
* Lock/unlock an individual logical volume
* If it's active, LCK_WRITE suspends it; LCK_EXCLUSIVE deactivates it;
* LCK_NONE unsuspends it.
* LCK_READ activates it.
* char *vol holds "VG_name/LV_uuid"
*
* FIXME: Change to something like
* int lock_vol(struct cmd_context *cmd, const struct id *id, int flags);
* char *vol holds lvid
*/
int lock_vol(struct cmd_context *cmd, const char *vol, int flags);
@ -64,3 +58,6 @@ int lock_vol(struct cmd_context *cmd, const char *vol, int flags);
#define LCK_LV_ACTIVATE (LCK_LV | LCK_READ)
#define LCK_LV_UNLOCK (LCK_LV | LCK_NONE)
#define unlock_lv(cmd, vol) lock_vol(cmd, vol, LCK_LV_UNLOCK)
#define unlock_vg(cmd, vol) lock_vol(cmd, vol, LCK_VG_UNLOCK)

View File

@ -159,14 +159,14 @@ static int lvchange_permission(struct cmd_context *cmd,
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
if (!cmd->fid->ops->vg_write(cmd->fid, lv->vg)) {
/* FIXME: Attempt reversion? */
lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK);
unlock_lv(cmd, lv->lvid.s);
return 0;
}
backup(lv->vg);
log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK)) {
if (!unlock_lv(cmd, lv->lvid.s)) {
log_error("Problem reactivating %s", lv->name);
return 0;
}
@ -247,14 +247,14 @@ static int lvchange_contiguous(struct cmd_context *cmd,
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
if (!cmd->fid->ops->vg_write(cmd->fid, lv->vg)) {
/* FIXME: Attempt reversion? */
lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK);
unlock_lv(cmd, lv->lvid.s);
return 0;
}
backup(lv->vg);
log_very_verbose("Reactivating \"%s\" in kernel", lv->name);
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK)) {
if (!unlock_lv(cmd, lv->lvid.s)) {
log_error("Problem reactivating %s", lv->name);
return 0;
}
@ -296,14 +296,14 @@ static int lvchange_readahead(struct cmd_context *cmd,
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
if (!cmd->fid->ops->vg_write(cmd->fid, lv->vg)) {
/* FIXME: Attempt reversion? */
lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK);
unlock_lv(cmd, lv->lvid.s);
return 0;
}
backup(lv->vg);
log_very_verbose("Reactivating \"%s\" in kernel", lv->name);
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK)) {
if (!unlock_lv(cmd, lv->lvid.s)) {
log_error("Problem reactivating %s", lv->name);
return 0;
}
@ -347,14 +347,14 @@ static int lvchange_persistent(struct cmd_context *cmd,
log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
if (!cmd->fid->ops->vg_write(cmd->fid, lv->vg)) {
/* FIXME: Attempt reversion? */
lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK);
unlock_lv(cmd, lv->lvid.s);
return 0;
}
backup(lv->vg);
log_very_verbose("Reactivating \"%s\" in kernel", lv->name);
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK)) {
if (!unlock_lv(cmd, lv->lvid.s)) {
log_error("Problem reactivating %s", lv->name);
return 0;
}

View File

@ -465,6 +465,6 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
r = 0;
out:
lock_vol(cmd, lp.vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, lp.vg_name);
return r;
}

View File

@ -136,11 +136,11 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
if (!(cmd->fid->ops->vg_write(cmd->fid, vg)))
goto lverror;
lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK);
unlock_lv(cmd, lv->lvid.s);
backup(lv->vg);
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
log_print("Renamed \"%s\" to \"%s\" in volume group \"%s\"",
lv_name_old, lv_name_new, vg_name);
@ -149,9 +149,9 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
lverror:
lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK);
unlock_lv(cmd, lv->lvid.s);
error:
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
return ECMD_FAILED;
}

View File

@ -339,28 +339,28 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
/* store vg on disk(s) */
if (!cmd->fid->ops->vg_write(cmd->fid, vg)) {
/* FIXME: Attempt reversion? */
lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK);
unlock_lv(cmd, lv->lvid.s);
goto error;
}
backup(vg);
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_UNLOCK)) {
if (!unlock_lv(cmd, lv->lvid.s)) {
log_error("Problem reactivating %s", lv_name);
goto error;
}
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
log_print("Logical volume %s successfully resized", lv_name);
return 0;
error:
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
return ECMD_FAILED;
error_cmdline:
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
return EINVALID_CMD_LINE;
}

View File

@ -104,26 +104,26 @@ int pvchange_single(struct cmd_context *cmd, struct physical_volume *pv)
}
if (!(vg = cmd->fid->ops->vg_read(cmd->fid, pv->vg_name))) {
lock_vol(cmd, pv->vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, pv->vg_name);
log_error("Unable to find volume group of \"%s\"",
pv_name);
return 0;
}
if (vg->status & EXPORTED_VG) {
lock_vol(cmd, pv->vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, pv->vg_name);
log_error("Volume group \"%s\" is exported", vg->name);
return ECMD_FAILED;
}
if (!(vg->status & LVM_WRITE)) {
lock_vol(cmd, pv->vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, pv->vg_name);
log_error("Volume group \"%s\" is read-only", vg->name);
return ECMD_FAILED;
}
if (!(pvl = find_pv_in_vg(vg, pv_name))) {
lock_vol(cmd, pv->vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, pv->vg_name);
log_error
("Unable to find \"%s\" in volume group \"%s\"",
pv_name, vg->name);
@ -139,7 +139,7 @@ int pvchange_single(struct cmd_context *cmd, struct physical_volume *pv)
log_error("Physical volume \"%s\" is already allocatable",
pv_name);
if (*pv->vg_name)
lock_vol(cmd, pv->vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, pv->vg_name);
return 0;
}
@ -147,7 +147,7 @@ int pvchange_single(struct cmd_context *cmd, struct physical_volume *pv)
log_error("Physical volume \"%s\" is already unallocatable",
pv_name);
if (*pv->vg_name)
lock_vol(cmd, pv->vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, pv->vg_name);
return 0;
}
@ -164,13 +164,13 @@ int pvchange_single(struct cmd_context *cmd, struct physical_volume *pv)
log_verbose("Updating physical volume \"%s\"", pv_name);
if (*pv->vg_name) {
if (!(cmd->fid->ops->vg_write(cmd->fid, vg))) {
lock_vol(cmd, pv->vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, pv->vg_name);
log_error("Failed to store physical volume \"%s\" in "
"volume group \"%s\"", pv_name, vg->name);
return 0;
}
backup(vg);
lock_vol(cmd, pv->vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, pv->vg_name);
} else {
if (!(cmd->fid->ops->pv_write(cmd->fid, pv))) {
log_error("Failed to store physical volume \"%s\"",

View File

@ -134,13 +134,13 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
log_verbose("Using volume group(s) on command line");
for (; opt < argc; opt++) {
vg_name = argv[opt];
if (!lock_vol(cmd, (void *) vg_name, LCK_VG | lock_type)) {
if (!lock_vol(cmd, vg_name, LCK_VG | lock_type)) {
log_error("Can't lock %s: skipping", vg_name);
continue;
}
if ((ret = process_single(cmd, vg_name)) > ret_max)
ret_max = ret;
lock_vol(cmd, (void *) vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
}
} else {
log_verbose("Finding all volume groups");
@ -150,7 +150,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
}
list_iterate(vgh, vgs) {
vg_name = list_item(vgh, struct name_list)->name;
if (!lock_vol(cmd, (void *) vg_name, LCK_VG | lock_type)) {
if (!lock_vol(cmd, vg_name, LCK_VG | lock_type)) {
log_error("Can't lock %s: skipping", vg_name);
continue;
}
@ -158,7 +158,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
if (ret > ret_max)
ret_max = ret;
lock_vol(cmd, (void *) vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
}
}

View File

@ -99,25 +99,25 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) {
log_error("Can't get lock for %s", vg_name);
lock_vol(cmd, "", LCK_VG_UNLOCK);
unlock_vg(cmd, "");
return ECMD_FAILED;
}
if (!archive(vg)) {
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
lock_vol(cmd, "", LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
return ECMD_FAILED;
}
/* Store VG on disk(s) */
if (!cmd->fid->ops->vg_write(cmd->fid, vg)) {
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
lock_vol(cmd, "", LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
return ECMD_FAILED;
}
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
lock_vol(cmd, "", LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
backup(vg);

View File

@ -47,7 +47,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
log_verbose("Checking for volume group \"%s\"", vg_name);
if (!lock_vol(cmd, vg_name, LCK_VG_WRITE | LCK_NONBLOCK)) {
lock_vol(cmd, "", LCK_VG_UNLOCK);
unlock_vg(cmd, "");
log_error("Can't get lock for %s", vg_name);
goto error;
}
@ -96,15 +96,15 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
backup(vg);
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
lock_vol(cmd, "", LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
log_print("Volume group \"%s\" successfully extended", vg_name);
return 0;
error:
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
lock_vol(cmd, "", LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
unlock_vg(cmd, "");
return ECMD_FAILED;
}

View File

@ -67,26 +67,26 @@ int vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
if (!(vg_to = cmd->fid->ops->vg_read(cmd->fid, vg_name_to))) {
log_error("Volume group \"%s\" doesn't exist", vg_name_to);
lock_vol(cmd, vg_name_to, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_to);
return ECMD_FAILED;
}
if (vg_to->status & EXPORTED_VG) {
log_error("Volume group \"%s\" is exported", vg_to->name);
lock_vol(cmd, vg_name_to, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_to);
return ECMD_FAILED;
}
if (!(vg_to->status & LVM_WRITE)) {
log_error("Volume group \"%s\" is read-only", vg_to->name);
lock_vol(cmd, vg_name_to, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_to);
return ECMD_FAILED;
}
log_verbose("Checking for volume group \"%s\"", vg_name_from);
if (!lock_vol(cmd, vg_name_from, LCK_VG_WRITE | LCK_NONBLOCK)) {
log_error("Can't get lock for %s", vg_name_from);
lock_vol(cmd, vg_name_to, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_to);
return ECMD_FAILED;
}
@ -190,15 +190,15 @@ int vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
backup(vg_to);
lock_vol(cmd, vg_name_from, LCK_VG_UNLOCK);
lock_vol(cmd, vg_name_to, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_from);
unlock_vg(cmd, vg_name_to);
log_print("Volume group \"%s\" successfully merged into \"%s\"",
vg_from->name, vg_to->name);
return 0;
error:
lock_vol(cmd, vg_name_from, LCK_VG_UNLOCK);
lock_vol(cmd, vg_name_to, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_from);
unlock_vg(cmd, vg_name_to);
return ECMD_FAILED;
}

View File

@ -58,25 +58,25 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
if (!(vg = cmd->fid->ops->vg_read(cmd->fid, vg_name))) {
log_error("Volume group \"%s\" doesn't exist", vg_name);
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
return ECMD_FAILED;
}
if (vg->status & EXPORTED_VG) {
log_error("Volume group \"%s\" is exported", vg->name);
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
return ECMD_FAILED;
}
if (!(vg->status & LVM_WRITE)) {
log_error("Volume group \"%s\" is read-only", vg_name);
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
return ECMD_FAILED;
}
if (!(vg->status & RESIZEABLE_VG)) {
log_error("Volume group \"%s\" is not reducable", vg_name);
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
return ECMD_FAILED;
}
@ -84,7 +84,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
/* and update in batch here? */
ret = process_each_pv(cmd, argc, argv, vg, vgreduce_single);
lock_vol(cmd, vg_name, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name);
return ret;

View File

@ -34,7 +34,7 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
ret = process_each_vg(cmd, argc, argv, LCK_WRITE | LCK_NONBLOCK,
&vgremove_single);
lock_vol(cmd, "", LCK_VG_UNLOCK);
unlock_vg(cmd, "");
return ret;
}

View File

@ -76,18 +76,18 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
if (!(vg_old = cmd->fid->ops->vg_read(cmd->fid, vg_name_old))) {
log_error("Volume group \"%s\" doesn't exist", vg_name_old);
lock_vol(cmd, vg_name_old, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_old);
return ECMD_FAILED;
}
if (vg_old->status & EXPORTED_VG) {
lock_vol(cmd, vg_name_old, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_old);
log_error("Volume group \"%s\" is exported", vg_old->name);
return ECMD_FAILED;
}
if (!(vg_old->status & LVM_WRITE)) {
lock_vol(cmd, vg_name_old, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_old);
log_error("Volume group \"%s\" is read-only", vg_old->name);
return ECMD_FAILED;
}
@ -98,7 +98,7 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
/***** FIXME Handle this with multiple LV renames!
if (!force_ARG) {
log_error("Use -f to force the rename");
lock_vol(cmd, vg_name_old, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_old);
return ECMD_FAILED;
}
*****/
@ -107,7 +107,7 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
log_verbose("Checking for new volume group \"%s\"", vg_name_new);
if (!lock_vol(cmd, vg_name_new, LCK_VG_WRITE | LCK_NONBLOCK)) {
lock_vol(cmd, vg_name_old, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_old);
log_error("Can't get lock for %s", vg_name_new);
return ECMD_FAILED;
}
@ -158,8 +158,8 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
backup(vg_old);
lock_vol(cmd, vg_name_new, LCK_VG_UNLOCK);
lock_vol(cmd, vg_name_old, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_new);
unlock_vg(cmd, vg_name_old);
log_print("Volume group \"%s\" successfully renamed to \"%s\"",
vg_name_old, vg_name_new);
@ -167,8 +167,8 @@ int vgrename(struct cmd_context *cmd, int argc, char **argv)
return 0;
error:
lock_vol(cmd, vg_name_new, LCK_VG_UNLOCK);
lock_vol(cmd, vg_name_old, LCK_VG_UNLOCK);
unlock_vg(cmd, vg_name_new);
unlock_vg(cmd, vg_name_old);
return ECMD_FAILED;
}