]> sourceware.org Git - lvm2.git/commit
pvscan: autoactivate a VG once
authorDavid Teigland <teigland@redhat.com>
Wed, 13 Feb 2019 20:21:56 +0000 (14:21 -0600)
committerDavid Teigland <teigland@redhat.com>
Thu, 21 Feb 2019 21:17:41 +0000 (15:17 -0600)
commit74a388cca15baa4149a24e37bccb421c53f726e5
treea067a5ae139683d174f0fd4791ecf74c72fd38ab
parentf0089472e7fd679acbc004daf4b35e9a86fc11a9
pvscan: autoactivate a VG once

When a VG has multiple PVs, and all those PVs come online
at the same time, concurrent pvscans for each PV will all
create the individual pvid files, and all will often see
the VG is now complete.  This causes each of the pvscan
commands to think it should activate the VG, so there
are multiple activations of the same VG.  The vg lock
serializes them, and only the first pvscan actually does
the activation, but there is still a lot of extra overhead
and time used by the other pvscans that attempt to
activate the already active VG.  This can lead to a backlog
of pvscans and timeouts.

To fix this, this adds a new /run/lvm/vgs_online/ dir that
works like the existing /run/lvm/pvs_online/ dir.  Each pvscan
that wants to activate a VG will first try to exlusively create
the file vgs_online/<vgname>.  Only the first pvscan will
succeed, and that one will do the VG activation. The other
pvscans will find the vgname file exists and will not do the
activation step.

When a PV goes offline, the vgs_online file for the corresponding
VG is removed.  This allows the VG to be autoactivated again
when the PV comes online again.  This requires that the vgname be
stored in the pvid files.
test/shell/pvscan-autoactivate.sh
test/shell/pvscan-cache.sh
tools/pvscan.c
This page took 0.039519 seconds and 5 git commands to generate.