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

Avoid looping forever in _pv_analyze_mda_raw used by pvck.

This commit is contained in:
Alasdair Kergon 2008-07-31 13:07:01 +00:00
parent 021317a547
commit 131bc6f091
3 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.40 -
================================
Avoid looping forever in _pv_analyze_mda_raw used by pvck.
Change lvchange exit status to indicate if any part of the operation failed.
Fix pvchange and pvremove to handle PVs without mdas.
Refactor _text_pv_read and always return mda list if requested.

View File

@ -1276,7 +1276,7 @@ unsigned maybe_config_section(const char *str, unsigned len)
begin_count = _count_tokens(str, len, TOK_SECTION_B);
end_count = _count_tokens(str, len, TOK_SECTION_E);
if (begin_count && end_count && (begin_count - end_count == 0))
if (begin_count && end_count && (begin_count == end_count))
return 1;
else
return 0;

View File

@ -139,7 +139,7 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
struct raw_locn *rlocn;
uint64_t area_start;
uint64_t area_size;
uint64_t prev_sector;
uint64_t prev_sector, prev_sector2;
uint64_t latest_mrec_offset;
int i;
uint64_t offset;
@ -184,8 +184,11 @@ static int _pv_analyze_mda_raw (const struct format_type * fmt,
offset2 = size2 = 0;
i = 0;
while (prev_sector != latest_mrec_offset) {
prev_sector2 = prev_sector;
prev_sector = _get_prev_sector_circular(area_start, area_size,
prev_sector);
if (prev_sector > prev_sector2)
goto_out;
/*
* FIXME: for some reason, the whole metadata region from
* area->start to area->start+area->size is not used.