mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Change LV locking macros to take lv instead of lvid.
This commit is contained in:
parent
07d318310b
commit
0fb173aa3a
@ -1,5 +1,6 @@
|
|||||||
Version 2.01.15 -
|
Version 2.01.15 -
|
||||||
=================================
|
=================================
|
||||||
|
Change LV locking macros to take lv instead of lvid.
|
||||||
Prepend 'cluster' activation parameter to mirror log when appropriate.
|
Prepend 'cluster' activation parameter to mirror log when appropriate.
|
||||||
Pass exclusive flag to lv_activate and on to target activation code.
|
Pass exclusive flag to lv_activate and on to target activation code.
|
||||||
Prevent snapshot creation in a clustered VG for now.
|
Prevent snapshot creation in a clustered VG for now.
|
||||||
|
@ -268,7 +268,7 @@ int resume_lvs(struct cmd_context *cmd, struct list *lvs)
|
|||||||
struct lv_list *lvl;
|
struct lv_list *lvl;
|
||||||
|
|
||||||
list_iterate_items(lvl, lvs)
|
list_iterate_items(lvl, lvs)
|
||||||
resume_lv(cmd, lvl->lv->lvid.s);
|
resume_lv(cmd, lvl->lv);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -280,11 +280,11 @@ int suspend_lvs(struct cmd_context *cmd, struct list *lvs)
|
|||||||
struct lv_list *lvl;
|
struct lv_list *lvl;
|
||||||
|
|
||||||
list_iterate_items(lvl, lvs) {
|
list_iterate_items(lvl, lvs) {
|
||||||
if (!suspend_lv(cmd, lvl->lv->lvid.s)) {
|
if (!suspend_lv(cmd, lvl->lv)) {
|
||||||
log_error("Failed to suspend %s", lvl->lv->name);
|
log_error("Failed to suspend %s", lvl->lv->name);
|
||||||
list_uniterate(lvh, lvs, &lvl->list) {
|
list_uniterate(lvh, lvs, &lvl->list) {
|
||||||
lvl = list_item(lvh, struct lv_list);
|
lvl = list_item(lvh, struct lv_list);
|
||||||
resume_lv(cmd, lvl->lv->lvid.s);
|
resume_lv(cmd, lvl->lv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -301,11 +301,11 @@ int activate_lvs_excl(struct cmd_context *cmd, struct list *lvs)
|
|||||||
struct lv_list *lvl;
|
struct lv_list *lvl;
|
||||||
|
|
||||||
list_iterate_items(lvl, lvs) {
|
list_iterate_items(lvl, lvs) {
|
||||||
if (!activate_lv_excl(cmd, lvl->lv->lvid.s)) {
|
if (!activate_lv_excl(cmd, lvl->lv)) {
|
||||||
log_error("Failed to activate %s", lvl->lv->name);
|
log_error("Failed to activate %s", lvl->lv->name);
|
||||||
list_uniterate(lvh, lvs, &lvl->list) {
|
list_uniterate(lvh, lvs, &lvl->list) {
|
||||||
lvl = list_item(lvh, struct lv_list);
|
lvl = list_item(lvh, struct lv_list);
|
||||||
activate_lv(cmd, lvl->lv->lvid.s);
|
activate_lv(cmd, lvl->lv);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -81,16 +81,16 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
|
|||||||
|
|
||||||
#define unlock_vg(cmd, vol) lock_vol(cmd, vol, LCK_VG_UNLOCK)
|
#define unlock_vg(cmd, vol) lock_vol(cmd, vol, LCK_VG_UNLOCK)
|
||||||
|
|
||||||
#define resume_lv(cmd, vol) lock_vol(cmd, vol, LCK_LV_RESUME)
|
#define resume_lv(cmd, lv) lock_vol(cmd, (lv)->lvid.s, LCK_LV_RESUME)
|
||||||
#define suspend_lv(cmd, vol) lock_vol(cmd, vol, LCK_LV_SUSPEND | LCK_HOLD)
|
#define suspend_lv(cmd, lv) lock_vol(cmd, (lv)->lvid.s, LCK_LV_SUSPEND | LCK_HOLD)
|
||||||
#define deactivate_lv(cmd, vol) lock_vol(cmd, vol, LCK_LV_DEACTIVATE)
|
#define deactivate_lv(cmd, lv) lock_vol(cmd, (lv)->lvid.s, LCK_LV_DEACTIVATE)
|
||||||
#define activate_lv(cmd, vol) lock_vol(cmd, vol, LCK_LV_ACTIVATE | LCK_HOLD)
|
#define activate_lv(cmd, lv) lock_vol(cmd, (lv)->lvid.s, LCK_LV_ACTIVATE | LCK_HOLD)
|
||||||
#define activate_lv_excl(cmd, vol) \
|
#define activate_lv_excl(cmd, lv) \
|
||||||
lock_vol(cmd, vol, LCK_LV_EXCLUSIVE | LCK_HOLD)
|
lock_vol(cmd, (lv)->lvid.s, LCK_LV_EXCLUSIVE | LCK_HOLD)
|
||||||
#define activate_lv_local(cmd, vol) \
|
#define activate_lv_local(cmd, lv) \
|
||||||
lock_vol(cmd, vol, LCK_LV_ACTIVATE | LCK_HOLD | LCK_LOCAL)
|
lock_vol(cmd, (lv)->lvid.s, LCK_LV_ACTIVATE | LCK_HOLD | LCK_LOCAL)
|
||||||
#define deactivate_lv_local(cmd, vol) \
|
#define deactivate_lv_local(cmd, lv) \
|
||||||
lock_vol(cmd, vol, LCK_LV_DEACTIVATE | LCK_LOCAL)
|
lock_vol(cmd, (lv)->lvid.s, LCK_LV_DEACTIVATE | LCK_LOCAL)
|
||||||
|
|
||||||
/* Process list of LVs */
|
/* Process list of LVs */
|
||||||
int suspend_lvs(struct cmd_context *cmd, struct list *lvs);
|
int suspend_lvs(struct cmd_context *cmd, struct list *lvs);
|
||||||
|
@ -52,19 +52,19 @@ static int lvchange_permission(struct cmd_context *cmd,
|
|||||||
|
|
||||||
backup(lv->vg);
|
backup(lv->vg);
|
||||||
|
|
||||||
if (!suspend_lv(cmd, lv->lvid.s)) {
|
if (!suspend_lv(cmd, lv)) {
|
||||||
log_error("Failed to lock %s", lv->name);
|
log_error("Failed to lock %s", lv->name);
|
||||||
vg_revert(lv->vg);
|
vg_revert(lv->vg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vg_commit(lv->vg)) {
|
if (!vg_commit(lv->vg)) {
|
||||||
resume_lv(cmd, lv->lvid.s);
|
resume_lv(cmd, lv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
|
log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
|
||||||
if (!resume_lv(cmd, lv->lvid.s)) {
|
if (!resume_lv(cmd, lv)) {
|
||||||
log_error("Problem reactivating %s", lv->name);
|
log_error("Problem reactivating %s", lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -83,13 +83,13 @@ static int lvchange_availability(struct cmd_context *cmd,
|
|||||||
if (activate == CHANGE_ALN) {
|
if (activate == CHANGE_ALN) {
|
||||||
log_verbose("Deactivating logical volume \"%s\" locally",
|
log_verbose("Deactivating logical volume \"%s\" locally",
|
||||||
lv->name);
|
lv->name);
|
||||||
if (!deactivate_lv_local(cmd, lv->lvid.s)) {
|
if (!deactivate_lv_local(cmd, lv)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (activate == CHANGE_AN) {
|
} else if (activate == CHANGE_AN) {
|
||||||
log_verbose("Deactivating logical volume \"%s\"", lv->name);
|
log_verbose("Deactivating logical volume \"%s\"", lv->name);
|
||||||
if (!deactivate_lv(cmd, lv->lvid.s)) {
|
if (!deactivate_lv(cmd, lv)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -103,21 +103,21 @@ static int lvchange_availability(struct cmd_context *cmd,
|
|||||||
if (lv_is_origin(lv) || (activate == CHANGE_AE)) {
|
if (lv_is_origin(lv) || (activate == CHANGE_AE)) {
|
||||||
log_verbose("Activating logical volume \"%s\" "
|
log_verbose("Activating logical volume \"%s\" "
|
||||||
"exclusively", lv->name);
|
"exclusively", lv->name);
|
||||||
if (!activate_lv_excl(cmd, lv->lvid.s)) {
|
if (!activate_lv_excl(cmd, lv)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (activate == CHANGE_ALY) {
|
} else if (activate == CHANGE_ALY) {
|
||||||
log_verbose("Activating logical volume \"%s\" locally",
|
log_verbose("Activating logical volume \"%s\" locally",
|
||||||
lv->name);
|
lv->name);
|
||||||
if (!activate_lv_local(cmd, lv->lvid.s)) {
|
if (!activate_lv_local(cmd, lv)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log_verbose("Activating logical volume \"%s\"",
|
log_verbose("Activating logical volume \"%s\"",
|
||||||
lv->name);
|
lv->name);
|
||||||
if (!activate_lv(cmd, lv->lvid.s)) {
|
if (!activate_lv(cmd, lv)) {
|
||||||
stack;
|
stack;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ static int lvchange_availability(struct cmd_context *cmd,
|
|||||||
static int lvchange_refresh(struct cmd_context *cmd, struct logical_volume *lv)
|
static int lvchange_refresh(struct cmd_context *cmd, struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
log_verbose("Refreshing logical volume \"%s\" (if active)", lv->name);
|
log_verbose("Refreshing logical volume \"%s\" (if active)", lv->name);
|
||||||
if (!suspend_lv(cmd, lv->lvid.s) || !resume_lv(cmd, lv->lvid.s))
|
if (!suspend_lv(cmd, lv) || !resume_lv(cmd, lv))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -216,19 +216,19 @@ static int lvchange_readahead(struct cmd_context *cmd,
|
|||||||
|
|
||||||
backup(lv->vg);
|
backup(lv->vg);
|
||||||
|
|
||||||
if (!suspend_lv(cmd, lv->lvid.s)) {
|
if (!suspend_lv(cmd, lv)) {
|
||||||
log_error("Failed to lock %s", lv->name);
|
log_error("Failed to lock %s", lv->name);
|
||||||
vg_revert(lv->vg);
|
vg_revert(lv->vg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vg_commit(lv->vg)) {
|
if (!vg_commit(lv->vg)) {
|
||||||
resume_lv(cmd, lv->lvid.s);
|
resume_lv(cmd, lv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
|
log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
|
||||||
if (!resume_lv(cmd, lv->lvid.s)) {
|
if (!resume_lv(cmd, lv)) {
|
||||||
log_error("Problem reactivating %s", lv->name);
|
log_error("Problem reactivating %s", lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ static int lvchange_persistent(struct cmd_context *cmd,
|
|||||||
active = 1;
|
active = 1;
|
||||||
}
|
}
|
||||||
log_verbose("Ensuring %s is inactive.", lv->name);
|
log_verbose("Ensuring %s is inactive.", lv->name);
|
||||||
if (!deactivate_lv(cmd, lv->lvid.s)) {
|
if (!deactivate_lv(cmd, lv)) {
|
||||||
log_error("%s: deactivation failed", lv->name);
|
log_error("%s: deactivation failed", lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ static int lvchange_persistent(struct cmd_context *cmd,
|
|||||||
if (active) {
|
if (active) {
|
||||||
log_verbose("Re-activating logical volume \"%s\"",
|
log_verbose("Re-activating logical volume \"%s\"",
|
||||||
lv->name);
|
lv->name);
|
||||||
if (!activate_lv(cmd, lv->lvid.s)) {
|
if (!activate_lv(cmd, lv)) {
|
||||||
log_error("%s: reactivation failed", lv->name);
|
log_error("%s: reactivation failed", lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -301,19 +301,19 @@ static int lvchange_persistent(struct cmd_context *cmd,
|
|||||||
|
|
||||||
backup(lv->vg);
|
backup(lv->vg);
|
||||||
|
|
||||||
if (!suspend_lv(cmd, lv->lvid.s)) {
|
if (!suspend_lv(cmd, lv)) {
|
||||||
log_error("Failed to lock %s", lv->name);
|
log_error("Failed to lock %s", lv->name);
|
||||||
vg_revert(lv->vg);
|
vg_revert(lv->vg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vg_commit(lv->vg)) {
|
if (!vg_commit(lv->vg)) {
|
||||||
resume_lv(cmd, lv->lvid.s);
|
resume_lv(cmd, lv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
|
log_very_verbose("Updating permissions for \"%s\" in kernel", lv->name);
|
||||||
if (!resume_lv(cmd, lv->lvid.s)) {
|
if (!resume_lv(cmd, lv)) {
|
||||||
log_error("Problem reactivating %s", lv->name);
|
log_error("Problem reactivating %s", lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -93,20 +93,20 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l
|
|||||||
|
|
||||||
backup(lv->vg);
|
backup(lv->vg);
|
||||||
|
|
||||||
if (!suspend_lv(cmd, lv->lvid.s)) {
|
if (!suspend_lv(cmd, lv)) {
|
||||||
log_error("Failed to lock %s", lv->name);
|
log_error("Failed to lock %s", lv->name);
|
||||||
vg_revert(lv->vg);
|
vg_revert(lv->vg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vg_commit(lv->vg)) {
|
if (!vg_commit(lv->vg)) {
|
||||||
resume_lv(cmd, lv->lvid.s);
|
resume_lv(cmd, lv);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_very_verbose("Updating \"%s\" in kernel", lv->name);
|
log_very_verbose("Updating \"%s\" in kernel", lv->name);
|
||||||
|
|
||||||
if (!resume_lv(cmd, lv->lvid.s)) {
|
if (!resume_lv(cmd, lv)) {
|
||||||
log_error("Problem reactivating %s", lv->name);
|
log_error("Problem reactivating %s", lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -623,7 +623,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!activate_lv(cmd, log_lv->lvid.s)) {
|
if (!activate_lv(cmd, log_lv)) {
|
||||||
log_error("Aborting. Failed to activate mirror log. "
|
log_error("Aborting. Failed to activate mirror log. "
|
||||||
"Remove new LVs and retry.");
|
"Remove new LVs and retry.");
|
||||||
goto error;
|
goto error;
|
||||||
@ -635,7 +635,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!deactivate_lv(cmd, log_lv->lvid.s)) {
|
if (!deactivate_lv(cmd, log_lv)) {
|
||||||
log_error("Aborting. Failed to deactivate mirror log. "
|
log_error("Aborting. Failed to deactivate mirror log. "
|
||||||
"Remove new LV and retry.");
|
"Remove new LV and retry.");
|
||||||
goto error;
|
goto error;
|
||||||
@ -711,7 +711,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!activate_lv(cmd, lv->lvid.s)) {
|
if (!activate_lv(cmd, lv)) {
|
||||||
if (lp->snapshot)
|
if (lp->snapshot)
|
||||||
/* FIXME Remove the failed lv we just added */
|
/* FIXME Remove the failed lv we just added */
|
||||||
log_error("Aborting. Failed to activate snapshot "
|
log_error("Aborting. Failed to activate snapshot "
|
||||||
@ -737,13 +737,13 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
|||||||
/* Reset permission after zeroing */
|
/* Reset permission after zeroing */
|
||||||
if (!(lp->permission & LVM_WRITE))
|
if (!(lp->permission & LVM_WRITE))
|
||||||
lv->status &= ~LVM_WRITE;
|
lv->status &= ~LVM_WRITE;
|
||||||
if (!deactivate_lv(cmd, lv->lvid.s)) {
|
if (!deactivate_lv(cmd, lv)) {
|
||||||
log_err("Couldn't deactivate new snapshot.");
|
log_err("Couldn't deactivate new snapshot.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME write/commit/backup sequence issue */
|
/* FIXME write/commit/backup sequence issue */
|
||||||
if (!suspend_lv(cmd, org->lvid.s)) {
|
if (!suspend_lv(cmd, org)) {
|
||||||
log_error("Failed to suspend origin %s", org->name);
|
log_error("Failed to suspend origin %s", org->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -758,7 +758,7 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
|
|||||||
if (!vg_write(vg) || !vg_commit(vg))
|
if (!vg_write(vg) || !vg_commit(vg))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!resume_lv(cmd, org->lvid.s)) {
|
if (!resume_lv(cmd, org)) {
|
||||||
log_error("Problem reactivating origin %s", org->name);
|
log_error("Problem reactivating origin %s", org->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
if (!archive(vg))
|
if (!archive(vg))
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
|
|
||||||
if (!deactivate_lv(cmd, lv->lvid.s)) {
|
if (!deactivate_lv(cmd, lv)) {
|
||||||
log_error("Unable to deactivate logical volume \"%s\"",
|
log_error("Unable to deactivate logical volume \"%s\"",
|
||||||
lv->name);
|
lv->name);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
|
@ -158,18 +158,18 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
|
|
||||||
backup(lv->vg);
|
backup(lv->vg);
|
||||||
|
|
||||||
if (!suspend_lv(cmd, lv->lvid.s)) {
|
if (!suspend_lv(cmd, lv)) {
|
||||||
stack;
|
stack;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vg_commit(vg)) {
|
if (!vg_commit(vg)) {
|
||||||
stack;
|
stack;
|
||||||
resume_lv(cmd, lv->lvid.s);
|
resume_lv(cmd, lv);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
resume_lv(cmd, lv->lvid.s);
|
resume_lv(cmd, lv);
|
||||||
|
|
||||||
unlock_vg(cmd, vg_name);
|
unlock_vg(cmd, vg_name);
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
|||||||
uint32_t extents_used = 0;
|
uint32_t extents_used = 0;
|
||||||
uint32_t size_rest;
|
uint32_t size_rest;
|
||||||
alloc_policy_t alloc;
|
alloc_policy_t alloc;
|
||||||
char *lock_lvid;
|
struct logical_volume *lock_lv;
|
||||||
struct lv_list *lvl;
|
struct lv_list *lvl;
|
||||||
int consistent = 1;
|
int consistent = 1;
|
||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
@ -518,11 +518,11 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
|||||||
|
|
||||||
/* If snapshot, must suspend all associated devices */
|
/* If snapshot, must suspend all associated devices */
|
||||||
if ((snap_seg = find_cow(lv)))
|
if ((snap_seg = find_cow(lv)))
|
||||||
lock_lvid = snap_seg->origin->lvid.s;
|
lock_lv = snap_seg->origin;
|
||||||
else
|
else
|
||||||
lock_lvid = lv->lvid.s;
|
lock_lv = lv;
|
||||||
|
|
||||||
if (!suspend_lv(cmd, lock_lvid)) {
|
if (!suspend_lv(cmd, lock_lv)) {
|
||||||
log_error("Failed to suspend %s", lp->lv_name);
|
log_error("Failed to suspend %s", lp->lv_name);
|
||||||
vg_revert(vg);
|
vg_revert(vg);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
@ -530,11 +530,11 @@ static int _lvresize(struct cmd_context *cmd, struct lvresize_params *lp)
|
|||||||
|
|
||||||
if (!vg_commit(vg)) {
|
if (!vg_commit(vg)) {
|
||||||
stack;
|
stack;
|
||||||
resume_lv(cmd, lock_lvid);
|
resume_lv(cmd, lock_lv);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!resume_lv(cmd, lock_lvid)) {
|
if (!resume_lv(cmd, lock_lv)) {
|
||||||
log_error("Problem reactivating %s", lp->lv_name);
|
log_error("Problem reactivating %s", lp->lv_name);
|
||||||
return ECMD_FAILED;
|
return ECMD_FAILED;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
|
|
||||||
/* Suspend mirrors on subsequent calls */
|
/* Suspend mirrors on subsequent calls */
|
||||||
if (!first_time) {
|
if (!first_time) {
|
||||||
if (!suspend_lv(cmd, lv_mirr->lvid.s)) {
|
if (!suspend_lv(cmd, lv_mirr)) {
|
||||||
stack;
|
stack;
|
||||||
resume_lvs(cmd, lvs_changed);
|
resume_lvs(cmd, lvs_changed);
|
||||||
vg_revert(vg);
|
vg_revert(vg);
|
||||||
@ -231,7 +231,7 @@ static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
if (!vg_commit(vg)) {
|
if (!vg_commit(vg)) {
|
||||||
log_error("ABORTING: Volume group metadata update failed.");
|
log_error("ABORTING: Volume group metadata update failed.");
|
||||||
if (!first_time)
|
if (!first_time)
|
||||||
resume_lv(cmd, lv_mirr->lvid.s);
|
resume_lv(cmd, lv_mirr);
|
||||||
resume_lvs(cmd, lvs_changed);
|
resume_lvs(cmd, lvs_changed);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
/* Only the first mirror segment gets activated as a mirror */
|
/* Only the first mirror segment gets activated as a mirror */
|
||||||
/* FIXME: Add option to use a log */
|
/* FIXME: Add option to use a log */
|
||||||
if (first_time) {
|
if (first_time) {
|
||||||
if (!activate_lv_excl(cmd, lv_mirr->lvid.s)) {
|
if (!activate_lv_excl(cmd, lv_mirr)) {
|
||||||
if (!test_mode())
|
if (!test_mode())
|
||||||
log_error("ABORTING: Temporary mirror "
|
log_error("ABORTING: Temporary mirror "
|
||||||
"activation failed. "
|
"activation failed. "
|
||||||
@ -249,7 +249,7 @@ static int _update_metadata(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
resume_lvs(cmd, lvs_changed);
|
resume_lvs(cmd, lvs_changed);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (!resume_lv(cmd, lv_mirr->lvid.s)) {
|
} else if (!resume_lv(cmd, lv_mirr)) {
|
||||||
log_error("Unable to reactivate logical volume \"%s\"",
|
log_error("Unable to reactivate logical volume \"%s\"",
|
||||||
lv_mirr->name);
|
lv_mirr->name);
|
||||||
resume_lvs(cmd, lvs_changed);
|
resume_lvs(cmd, lvs_changed);
|
||||||
@ -318,7 +318,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Ensure mirror LV is active */
|
/* Ensure mirror LV is active */
|
||||||
if (!activate_lv_excl(cmd, lv_mirr->lvid.s)) {
|
if (!activate_lv_excl(cmd, lv_mirr)) {
|
||||||
log_error
|
log_error
|
||||||
("ABORTING: Temporary mirror activation failed.");
|
("ABORTING: Temporary mirror activation failed.");
|
||||||
unlock_vg(cmd, pv->vg_name);
|
unlock_vg(cmd, pv->vg_name);
|
||||||
@ -415,7 +415,7 @@ static int _finish_pvmove(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Suspend mirror LV to flush pending I/O */
|
/* Suspend mirror LV to flush pending I/O */
|
||||||
if (!suspend_lv(cmd, lv_mirr->lvid.s)) {
|
if (!suspend_lv(cmd, lv_mirr)) {
|
||||||
log_error("Suspension of temporary mirror LV failed");
|
log_error("Suspension of temporary mirror LV failed");
|
||||||
r = 0;
|
r = 0;
|
||||||
}
|
}
|
||||||
@ -425,13 +425,13 @@ static int _finish_pvmove(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
log_error("ABORTING: Failed to write new data locations "
|
log_error("ABORTING: Failed to write new data locations "
|
||||||
"to disk.");
|
"to disk.");
|
||||||
vg_revert(vg);
|
vg_revert(vg);
|
||||||
resume_lv(cmd, lv_mirr->lvid.s);
|
resume_lv(cmd, lv_mirr);
|
||||||
resume_lvs(cmd, lvs_changed);
|
resume_lvs(cmd, lvs_changed);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Release mirror LV. (No pending I/O because it's been suspended.) */
|
/* Release mirror LV. (No pending I/O because it's been suspended.) */
|
||||||
if (!resume_lv(cmd, lv_mirr->lvid.s)) {
|
if (!resume_lv(cmd, lv_mirr)) {
|
||||||
log_error("Unable to reactivate logical volume \"%s\"",
|
log_error("Unable to reactivate logical volume \"%s\"",
|
||||||
lv_mirr->name);
|
lv_mirr->name);
|
||||||
r = 0;
|
r = 0;
|
||||||
@ -441,7 +441,7 @@ static int _finish_pvmove(struct cmd_context *cmd, struct volume_group *vg,
|
|||||||
resume_lvs(cmd, lvs_changed);
|
resume_lvs(cmd, lvs_changed);
|
||||||
|
|
||||||
/* Deactivate mirror LV */
|
/* Deactivate mirror LV */
|
||||||
if (!deactivate_lv(cmd, lv_mirr->lvid.s)) {
|
if (!deactivate_lv(cmd, lv_mirr)) {
|
||||||
log_error("ABORTING: Unable to deactivate temporary logical "
|
log_error("ABORTING: Unable to deactivate temporary logical "
|
||||||
"volume \"%s\"", lv_mirr->name);
|
"volume \"%s\"", lv_mirr->name);
|
||||||
r = 0;
|
r = 0;
|
||||||
|
@ -37,18 +37,18 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (activate == CHANGE_AN) {
|
if (activate == CHANGE_AN) {
|
||||||
if (!deactivate_lv(cmd, lv->lvid.s))
|
if (!deactivate_lv(cmd, lv))
|
||||||
continue;
|
continue;
|
||||||
} else if (activate == CHANGE_ALN) {
|
} else if (activate == CHANGE_ALN) {
|
||||||
if (!deactivate_lv_local(cmd, lv->lvid.s))
|
if (!deactivate_lv_local(cmd, lv))
|
||||||
continue;
|
continue;
|
||||||
} else if (lv_is_origin(lv) || (activate == CHANGE_AE)) {
|
} else if (lv_is_origin(lv) || (activate == CHANGE_AE)) {
|
||||||
if (!activate_lv_excl(cmd, lv->lvid.s))
|
if (!activate_lv_excl(cmd, lv))
|
||||||
continue;
|
continue;
|
||||||
} else if (activate == CHANGE_ALY) {
|
} else if (activate == CHANGE_ALY) {
|
||||||
if (!activate_lv_local(cmd, lv->lvid.s))
|
if (!activate_lv_local(cmd, lv))
|
||||||
continue;
|
continue;
|
||||||
} else if (!activate_lv(cmd, lv->lvid.s))
|
} else if (!activate_lv(cmd, lv))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((lv->status & PVMOVE) &&
|
if ((lv->status & PVMOVE) &&
|
||||||
|
@ -61,7 +61,7 @@ static int _remove_lv(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
log_verbose("Deactivating (if active) logical volume %s",
|
log_verbose("Deactivating (if active) logical volume %s",
|
||||||
lv->name);
|
lv->name);
|
||||||
|
|
||||||
if (!deactivate_lv(cmd, lv->lvid.s)) {
|
if (!deactivate_lv(cmd, lv)) {
|
||||||
log_error("Failed to deactivate LV %s", lv->name);
|
log_error("Failed to deactivate LV %s", lv->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ static int _remove_lv(struct cmd_context *cmd, struct logical_volume *lv,
|
|||||||
log_verbose("Deactivating (if active) logical volume %s "
|
log_verbose("Deactivating (if active) logical volume %s "
|
||||||
"(origin of %s)", snap_seg->origin->name, lv->name);
|
"(origin of %s)", snap_seg->origin->name, lv->name);
|
||||||
|
|
||||||
if (!deactivate_lv(cmd, snap_seg->origin->lvid.s)) {
|
if (!deactivate_lv(cmd, snap_seg->origin)) {
|
||||||
log_error("Failed to deactivate LV %s",
|
log_error("Failed to deactivate LV %s",
|
||||||
snap_seg->origin->name);
|
snap_seg->origin->name);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user