1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: use lv_update_and_reload

Avoid code duplication and use exiting commonly used
lv_update_and_reload() function.

There is still one place left where mirror is doing strange
double suspend call - needs there more thinking what's wrong with
that code.
This commit is contained in:
Zdenek Kabelac 2016-11-23 10:57:36 +01:00
parent a04b4bb89e
commit 8a4dfe6ce7
2 changed files with 6 additions and 51 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.168 -
====================================
Use lv_update_and_reload() inside mirror code where it applies.
Preserve mirrored status for temporary layered mirrors.
Use transient raid check before repairing raid volume.
Implement transient status check for raid volumes.

View File

@ -798,36 +798,12 @@ static int _split_mirror_images(struct logical_volume *lv,
lv->status &= ~LV_NOTSYNCED;
}
if (!vg_write(mirrored_seg->lv->vg)) {
log_error("Intermediate VG metadata write failed.");
return 0;
}
/*
* Suspend the mirror - this includes all the sub-LVs and
* soon-to-be-split sub-LVs
* Suspend and resume the mirror - this includes all
* the sub-LVs and soon-to-be-split sub-LVs
*/
if (!suspend_lv(cmd, mirrored_seg->lv)) {
log_error("Failed to lock %s", mirrored_seg->lv->name);
vg_revert(mirrored_seg->lv->vg);
return 0;
}
if (!vg_commit(mirrored_seg->lv->vg)) {
resume_lv(cmd, mirrored_seg->lv);
return 0;
}
log_very_verbose("Updating \"%s\" in kernel", mirrored_seg->lv->name);
/*
* Resume the mirror - this also activates the visible, independent
* soon-to-be-split sub-LVs
*/
if (!resume_lv(cmd, mirrored_seg->lv)) {
log_error("Problem resuming %s", mirrored_seg->lv->name);
return 0;
}
if (!lv_update_and_reload(mirrored_seg->lv))
return_0;
/*
* Recycle newly split LV so it is properly renamed.
@ -1062,30 +1038,8 @@ static int _remove_mirror_images(struct logical_volume *lv,
return 0;
}
if (!vg_write(detached_log_lv->vg)) {
log_error("intermediate VG write failed.");
return 0;
}
if (!suspend_lv(detached_log_lv->vg->cmd,
detached_log_lv)) {
log_error("Failed to suspend %s",
detached_log_lv->name);
return 0;
}
if (!vg_commit(detached_log_lv->vg)) {
if (!resume_lv(detached_log_lv->vg->cmd,
detached_log_lv))
stack;
if (!lv_update_and_reload(detached_log_lv))
return_0;
}
if (!resume_lv(detached_log_lv->vg->cmd, detached_log_lv)) {
log_error("Failed to resume %s",
detached_log_lv->name);
return 0;
}
}
/*