1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-11 20:58:50 +03:00

Rewrite missing/corrupt metadata in more cases.

This commit is contained in:
Alasdair Kergon 2002-05-13 12:38:54 +00:00
parent 39ed033adb
commit 031079703f

View File

@ -426,8 +426,8 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name)
list_iterate(mdah, &fid->metadata_areas) { list_iterate(mdah, &fid->metadata_areas) {
mdl = list_item(mdah, struct metadata_area)->metadata_locn; mdl = list_item(mdah, struct metadata_area)->metadata_locn;
if (!(vg = fid->fmt->ops->vg_read(fid, vg_name, mdl))) { if (!(vg = fid->fmt->ops->vg_read(fid, vg_name, mdl))) {
stack; inconsistent = 1;
return NULL; continue;
} }
if (first_time) { if (first_time) {
correct_vg = vg; correct_vg = vg;
@ -441,6 +441,12 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name)
} }
} }
/* Failed to find VG */
if (first_time) {
stack;
return NULL;
}
if (inconsistent) { if (inconsistent) {
log_print("Inconsistent metadata copies found - updating " log_print("Inconsistent metadata copies found - updating "
"to use version %u", correct_vg->seqno); "to use version %u", correct_vg->seqno);
@ -452,7 +458,7 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name)
vgcache_add(vg_name, correct_vg->id.uuid, NULL, fmt); vgcache_add(vg_name, correct_vg->id.uuid, NULL, fmt);
return vg; return correct_vg;
} }
struct volume_group *vg_read_by_vgid(struct cmd_context *cmd, const char *vgid) struct volume_group *vg_read_by_vgid(struct cmd_context *cmd, const char *vgid)