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

print warning about in-use orphans

Warn about a PV that has the in-use flag set, but appears in
the orphan VG (no VG was found referencing it.)

There are a number of conditions that could lead to this:

. The PV was created with no mdas and is used in a VG with
  other PVs (with metadata) that have not yet appeared on
  the system.  So, no VG metadata is found by lvm which
  references the in-use PV with no mdas.

. vgremove could have failed after clearing mdas but
  before clearing the in-use flag.  In this case, the
  in-use flag needs to be manually cleared on the PV.

. The PV may have damanged/unrecognized VG metadata
  that lvm could not read.

. The PV may have no mdas, and the PVs with the metadata
  may have damaged/unrecognized metadata.
This commit is contained in:
David Teigland 2017-06-01 11:10:09 -05:00
parent f3c90e90f8
commit c98a25aab1
2 changed files with 37 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.172 - Version 2.02.172 -
=============================== ===============================
Print a warning about in-use PVs with no VG using them.
Disable automatic clearing of PVs that look like in-use orphans. Disable automatic clearing of PVs that look like in-use orphans.
Cache format2 flag is now using segment name type field. Cache format2 flag is now using segment name type field.
Support storing status flags via segtype name field. Support storing status flags via segtype name field.

View File

@ -3802,6 +3802,8 @@ static int _vg_read_orphan_pv(struct lvmcache_info *info, void *baton)
struct _vg_read_orphan_baton *b = baton; struct _vg_read_orphan_baton *b = baton;
struct physical_volume *pv = NULL; struct physical_volume *pv = NULL;
struct pv_list *pvl; struct pv_list *pvl;
uint32_t ext_version;
uint32_t ext_flags;
if (!(pv = _pv_read(b->vg->cmd, b->vg->vgmem, dev_name(lvmcache_device(info)), if (!(pv = _pv_read(b->vg->cmd, b->vg->vgmem, dev_name(lvmcache_device(info)),
b->vg->fid, b->warn_flags, 0))) { b->vg->fid, b->warn_flags, 0))) {
@ -3837,6 +3839,40 @@ static int _vg_read_orphan_pv(struct lvmcache_info *info, void *baton)
} }
*/ */
/*
* 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.
*/
ext_version = lvmcache_ext_version(info);
ext_flags = lvmcache_ext_flags(info);
/*
* Warn about a PV that has the in-use flag set, but appears in
* the orphan VG (no VG was found referencing it.)
* There are a number of conditions that could lead to this:
*
* . The PV was created with no mdas and is used in a VG with
* other PVs (with metadata) that have not yet appeared on
* the system. So, no VG metadata is found by lvm which
* references the in-use PV with no mdas.
*
* . vgremove could have failed after clearing mdas but
* before clearing the in-use flag. In this case, the
* in-use flag needs to be manually cleared on the PV.
*
* . The PV may have damanged/unrecognized VG metadata
* that lvm could not read.
*
* . The PV may have no mdas, and the PVs with the metadata
* may have damaged/unrecognized metadata.
*/
if ((ext_version >= 2) && (ext_flags & PV_EXT_USED)) {
log_warn("WARNING: PV %s is marked in use but no VG was found using it.", pv_dev_name(pv));
log_warn("WARNING: PV %s might need repairing.", pv_dev_name(pv));
}
return 1; return 1;
} }