mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
raid: improve table reload sequence
This is another place for 'common' use pattern or reload and activation of deleted devices. (Moving the exclusive activation to _deactivate_and_remove_lvs()). TODO: looks like halve of raid function is reloading just 'origin' - and the other full LV.
This commit is contained in:
parent
7dff632c11
commit
0690392040
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.169 -
|
Version 2.02.169 -
|
||||||
=====================================
|
=====================================
|
||||||
|
Reusing exiting code for raid image removal.
|
||||||
Fix pvmove leaving -pvmove0 error device in clustered VG.
|
Fix pvmove leaving -pvmove0 error device in clustered VG.
|
||||||
Avoid adding extra '_' at end of raid extracted images or metadata.
|
Avoid adding extra '_' at end of raid extracted images or metadata.
|
||||||
Optimize another _rmeta clearing code.
|
Optimize another _rmeta clearing code.
|
||||||
|
@ -248,11 +248,10 @@ static int _deactivate_and_remove_lvs(struct volume_group *vg, struct dm_list *r
|
|||||||
{
|
{
|
||||||
struct lv_list *lvl;
|
struct lv_list *lvl;
|
||||||
|
|
||||||
if (vg_is_clustered(vg))
|
/* Need to take lock/resume for proper deactivation */
|
||||||
/* Need to take lock for proper deactivation */
|
dm_list_iterate_items(lvl, removal_lvs)
|
||||||
dm_list_iterate_items(lvl, removal_lvs)
|
if (!activate_lv_excl_local(vg->cmd, lvl->lv))
|
||||||
if (!activate_lv_excl_local(vg->cmd, lvl->lv))
|
return_0;
|
||||||
return_0;
|
|
||||||
|
|
||||||
dm_list_iterate_items(lvl, removal_lvs) {
|
dm_list_iterate_items(lvl, removal_lvs) {
|
||||||
if (!deactivate_lv(vg->cmd, lvl->lv))
|
if (!deactivate_lv(vg->cmd, lvl->lv))
|
||||||
@ -1214,15 +1213,14 @@ static int _raid_remove_images(struct logical_volume *lv,
|
|||||||
struct dm_list *removal_lvs, int commit)
|
struct dm_list *removal_lvs, int commit)
|
||||||
{
|
{
|
||||||
struct dm_list removed_lvs;
|
struct dm_list removed_lvs;
|
||||||
struct lv_list *lvl;
|
|
||||||
|
|
||||||
dm_list_init(&removed_lvs);
|
|
||||||
|
|
||||||
if (!archive(lv->vg))
|
if (!archive(lv->vg))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!removal_lvs)
|
if (!removal_lvs) {
|
||||||
|
dm_list_init(&removed_lvs);
|
||||||
removal_lvs = &removed_lvs;
|
removal_lvs = &removed_lvs;
|
||||||
|
}
|
||||||
|
|
||||||
if (!_raid_extract_images(lv, 0, new_count, allocate_pvs, 1,
|
if (!_raid_extract_images(lv, 0, new_count, allocate_pvs, 1,
|
||||||
removal_lvs, removal_lvs)) {
|
removal_lvs, removal_lvs)) {
|
||||||
@ -1245,48 +1243,8 @@ static int _raid_remove_images(struct logical_volume *lv,
|
|||||||
if (!commit)
|
if (!commit)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!vg_write(lv->vg)) {
|
if (!lv_update_and_reload(lv))
|
||||||
log_error("Failed to write changes for %s.",
|
return_0;
|
||||||
display_lvname(lv));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!suspend_lv(lv->vg->cmd, lv)) {
|
|
||||||
log_error("Failed to suspend %s before committing changes.",
|
|
||||||
display_lvname(lv));
|
|
||||||
vg_revert(lv->vg);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!vg_commit(lv->vg)) {
|
|
||||||
log_error("Failed to commit changes for %s.",
|
|
||||||
display_lvname(lv));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We activate the extracted sub-LVs first so they are renamed
|
|
||||||
* and won't conflict with the remaining (possibly shifted)
|
|
||||||
* sub-LVs.
|
|
||||||
*/
|
|
||||||
dm_list_iterate_items(lvl, removal_lvs) {
|
|
||||||
if (!activate_lv_excl_local(lv->vg->cmd, lvl->lv)) {
|
|
||||||
log_error("Failed to resume extracted LVs.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!resume_lv(lv->vg->cmd, lv)) {
|
|
||||||
log_error("Failed to resume %s after committing changes.",
|
|
||||||
display_lvname(lv));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sync_local_dev_names(lv->vg->cmd)) {
|
|
||||||
log_error("Failed to sync local devices after committing changes for %s.",
|
|
||||||
display_lvname(lv));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Eliminate the extracted LVs
|
* Eliminate the extracted LVs
|
||||||
|
Loading…
Reference in New Issue
Block a user