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

lvmetad: pvscan: do not scan and read ignored MDAs from PVs

Metadata areas which are marked as ignored should not be scanned
and read during pvscan --cache. Otherwise, this can cause lvmetad
to cache out-of-date metadata in case other PVs with fresh metadata
are missing by chance.

Make this to work like in non-lvmetad case where the behaviour would
be the same as if the PV was orphan (in case we have no other PVs
with valid non-ignored metadata areas).
This commit is contained in:
Peter Rajnoha 2015-03-16 17:00:36 +01:00
parent ff5217f850
commit 038013cf42
3 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
Fix pvscan --cache to not scan and read ignored metadata areas on PVs.
Add After=iscsi-shutdown.service to blk-availability.service systemd unit.
Disallow vgconvert from changing metadata format when lvmetad is used.
Don't do a full read of VG when creating a new VG with an existing name.

4
lib/cache/lvmetad.c vendored
View File

@ -895,7 +895,9 @@ struct _lvmetad_pvscan_baton {
static int _lvmetad_pvscan_single(struct metadata_area *mda, void *baton)
{
struct _lvmetad_pvscan_baton *b = baton;
struct volume_group *this = mda->ops->vg_read(b->fid, "", mda, 1);
struct volume_group *this;
this = mda_is_ignored(mda) ? NULL : mda->ops->vg_read(b->fid, "", mda, 1);
/* FIXME Also ensure contents match etc. */
if (!b->vg || this->seqno > b->vg->seqno)

View File

@ -22,4 +22,17 @@ pvscan --cache
vgs | grep $vg1
# When MDA is ignored on PV, do not read any VG
# metadata from such PV as it may contain old
# metadata which hasn't been updated for some
# time and also since the MDA is marked as ignored,
# it should really be *ignored*!
pvchange --metadataignore y "$dev1"
aux disable_dev "$dev2"
pvscan --cache
check pv_field "$dev1" vg_name ""
aux enable_dev "$dev2"
pvscan --cache
check pv_field "$dev1" vg_name "$vg1"
vgremove -ff $vg1