1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

lvchange: backup final metadata

Shift backup after final metadata commit.

Synchronize with wiping.
This commit is contained in:
Zdenek Kabelac 2014-09-19 15:16:26 +02:00
parent f09f85d027
commit 3adc50ac22
2 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.112 - Version 2.02.112 -
===================================== =====================================
Backup final metadata after resync of mirror/raid.
Unify handling of --persistent option for lvcreate and lvchange. Unify handling of --persistent option for lvcreate and lvchange.
Validate major and minor numbers stored in metadata. Validate major and minor numbers stored in metadata.
Use -fPIE when linking -pie executables. Use -fPIE when linking -pie executables.

View File

@ -14,6 +14,7 @@
*/ */
#include "tools.h" #include "tools.h"
#include "memlock.h"
static int lvchange_permission(struct cmd_context *cmd, static int lvchange_permission(struct cmd_context *cmd,
struct logical_volume *lv) struct logical_volume *lv)
@ -416,7 +417,8 @@ static int lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)
return 0; return 0;
} }
backup(lv->vg); /* No backup for intermediate metadata, so just unlock memory */
memlock_unlock(lv->vg->cmd);
dm_list_iterate_items(lvl, &device_list) { dm_list_iterate_items(lvl, &device_list) {
if (!activate_lv_excl_local(cmd, lvl->lv)) { if (!activate_lv_excl_local(cmd, lvl->lv)) {
@ -449,6 +451,8 @@ static int lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)
} }
} }
sync_local_dev_names(lv->vg->cmd); /* Wait until devices are away */
/* Put metadata sub-LVs back in place */ /* Put metadata sub-LVs back in place */
if (!attach_metadata_devices(seg, &device_list)) { if (!attach_metadata_devices(seg, &device_list)) {
log_error("Failed to reattach %s device after clearing", log_error("Failed to reattach %s device after clearing",
@ -463,11 +467,14 @@ static int lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv)
} }
if (!_reactivate_lv(lv, active, exclusive)) { if (!_reactivate_lv(lv, active, exclusive)) {
backup(lv->vg);
log_error("Failed to reactivate %s after resync", log_error("Failed to reactivate %s after resync",
lv->name); lv->name);
return 0; return 0;
} }
backup(lv->vg);
return 1; return 1;
} }