1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00
lvm2/lib/metadata
Peter Rajnoha d97f1c89de metadata: _vg_read: check if PV_EXT_USED flag is set correctly for orphan PVs and do a repair if needed
If we know that the PV is orphan, meaning there's at least one MDA on
that PV which does not reference any VG and at the same time there's
PV_EXT_USED flag set, we're certainly in an inconsistent state and we
need to fix this.

For example, such situation can happen during vgremove/vgreduce if we
removed/reduced the VG, but we haven't written PV headers yet because
vgremove stopped abruptly for whatever reason just before writing new
PV headers with updated state, including PV extension flags (and so the
PV_EXT_USED flag).

However, in case the PV has no MDAs at all, we can't double-check
whether the PV_EXT_USED is correct or not - if that PV is marked
as used, it's either:
  - really used (but other disks with MDAs are missing)
  - or the error state as described above is hit

User needs to overwrite the PV header directly if it's really clear
the PV having no MDAs does not belong to any VG and at the same time
it's still marked as being in use (pvcreate -ff <dev_name> will fix this).

For example - /dev/sda here has 1 MDA, orphan and is incorrectly marked
with PV_EXT_USED flag:

$ pvs --binary -o+pv_in_use
  WARNING: Found inconsistent standalone Physical Volumes.
  WARNING: Repairing flag incorrectly marking Physical Volume /dev/sda as used.
  PV         VG     Fmt  Attr PSize   PFree   InUse
  /dev/sda          lvm2 ---  128.00m 128.00m     0
2016-02-15 12:44:46 +01:00
..
cache_manip.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lv_alloc.h doc: change fsf address 2016-01-21 12:11:37 +01:00
lv_manip.c cleanup: update messages 2016-02-11 18:38:40 +01:00
lv.c gcc: better code for older compiler 2016-02-12 10:17:39 +01:00
lv.h doc: change fsf address 2016-01-21 12:11:37 +01:00
merge.c doc: change fsf address 2016-01-21 12:11:37 +01:00
metadata-exported.h metadata: introduce PV_EXT_USED flag and bump PV_HEADER_EXTENSION_VSN 2016-02-15 12:44:46 +01:00
metadata.c metadata: _vg_read: check if PV_EXT_USED flag is set correctly for orphan PVs and do a repair if needed 2016-02-15 12:44:46 +01:00
metadata.h metadata: add_pv_to_vg: add 'new_pv' arg to state if the PV is about to be created 2016-02-15 12:44:46 +01:00
mirror.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pool_manip.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pv_alloc.h doc: change fsf address 2016-01-21 12:11:37 +01:00
pv_manip.c pv: check for the PV_EXT_USED flag and deny pvcreate/pvchange/pvremove/vgcreate on such PV (unless forced) 2016-02-15 12:44:46 +01:00
pv_map.c doc: change fsf address 2016-01-21 12:11:37 +01:00
pv_map.h doc: change fsf address 2016-01-21 12:11:37 +01:00
pv.c pv: add is_used_pv fn 2016-02-15 12:44:46 +01:00
pv.h pv: add is_used_pv fn 2016-02-15 12:44:46 +01:00
raid_manip.c doc: change fsf address 2016-01-21 12:11:37 +01:00
replicator_manip.c doc: change fsf address 2016-01-21 12:11:37 +01:00
segtype.c doc: change fsf address 2016-01-21 12:11:37 +01:00
segtype.h doc: change fsf address 2016-01-21 12:11:37 +01:00
snapshot_manip.c doc: change fsf address 2016-01-21 12:11:37 +01:00
thin_manip.c doc: change fsf address 2016-01-21 12:11:37 +01:00
vg.c refactor: rename struct pv_to_create --> struct pv_to_write 2016-02-15 12:44:45 +01:00
vg.h pv: issue different message of different type when we're overwriting existing PV header instead of creating a new one 2016-02-15 12:44:46 +01:00