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

Fix and precise metadata read errors for segment areas.

This commit is contained in:
Milan Broz 2009-07-09 11:29:41 +00:00
parent 563b6561a5
commit ac959238aa
2 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.49 - Version 2.02.49 -
================================ ================================
Fix and precise metadata read errors for segment areas.
Fix segment metadata read function errors to use proper segment name. Fix segment metadata read function errors to use proper segment name.
Add parent node to config_node structure. Add parent node to config_node structure.
Fix segment import functions to print segment name and logical volume name. Fix segment import functions to print segment name and logical volume name.

View File

@ -377,32 +377,29 @@ int text_import_areas(struct lv_segment *seg, const struct config_node *sn,
unsigned int s; unsigned int s;
struct config_value *cv; struct config_value *cv;
struct logical_volume *lv1; struct logical_volume *lv1;
const char *seg_name = sn->key; struct physical_volume *pv;
const char *seg_name = config_parent_name(sn);
if (!seg->area_count) { if (!seg->area_count) {
log_error("Zero areas not allowed for segment '%s'", sn->key); log_error("Zero areas not allowed for segment %s", seg_name);
return 0; return 0;
} }
for (cv = cn->v, s = 0; cv && s < seg->area_count; s++, cv = cv->next) { for (cv = cn->v, s = 0; cv && s < seg->area_count; s++, cv = cv->next) {
/* first we read the pv */ /* first we read the pv */
const char *bad = "Badly formed areas array for "
"segment '%s'.";
struct physical_volume *pv;
if (cv->type != CFG_STRING) { if (cv->type != CFG_STRING) {
log_error(bad, sn->key); log_error("Bad volume name in areas array for segment %s.", seg_name);
return 0; return 0;
} }
if (!cv->next) { if (!cv->next) {
log_error(bad, sn->key); log_error("Missing offset in areas array for segment %s.", seg_name);
return 0; return 0;
} }
if (cv->next->type != CFG_INT) { if (cv->next->type != CFG_INT) {
log_error(bad, sn->key); log_error("Bad offset in areas array for segment %s.", seg_name);
return 0; return 0;
} }