1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

metadata: check for PV extension version before doing any checks on PV extension flags

PV header extension versions:
  0 - the original PV without any extensions
  1 - bootloader area support added
  2 - PV_EXT_USED flag support added

So do the associated checks related to PV_EXT_USED flag only if
PV header extension found is of version 2 and higher.
This commit is contained in:
Peter Rajnoha 2015-03-16 18:23:43 +01:00
parent d97f1c89de
commit e0b1415105

View File

@ -3348,9 +3348,21 @@ static int _check_or_repair_orphan_pv_ext(struct physical_volume *pv,
struct lvmcache_info *info, struct lvmcache_info *info,
struct _vg_read_orphan_baton *b) struct _vg_read_orphan_baton *b)
{ {
uint32_t ext_version = lvmcache_ext_version(info);
uint32_t ext_flags = lvmcache_ext_flags(info); uint32_t ext_flags = lvmcache_ext_flags(info);
int at_least_one_mda_used; int at_least_one_mda_used;
/*
* Nothing to do if PV header extension < 2:
* - version 0 is PV header without any extensions,
* - version 1 has bootloader area support only and
* we're not checking anything for that one here.
*/
if (ext_version < 2) {
b->consistent = 1;
return 1;
}
if (ext_flags & PV_EXT_USED) { if (ext_flags & PV_EXT_USED) {
if (lvmcache_mda_count(info)) { if (lvmcache_mda_count(info)) {
at_least_one_mda_used = 0; at_least_one_mda_used = 0;