1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 01:55:10 +03:00
LVM2 mirror repository https://sourceware.org/lvm2/
Go to file
David Teigland d9a77e8bb4 lvmcache: simplify metadata cache
The copy of VG metadata stored in lvmcache was not being used
in general.  It pretended to be a generic VG metadata cache,
but was not being used except for clvmd activation.  There
it was used to avoid reading from disk while devices were
suspended, i.e. in resume.

This removes the code that attempted to make this look
like a generic metadata cache, and replaces with with
something narrowly targetted to what it's actually used for.

This is a way of passing the VG from suspend to resume in
clvmd.  Since in the case of clvmd one caller can't simply
pass the same VG to both suspend and resume, suspend needs
to stash the VG somewhere that resume can grab it from.
(resume doesn't want to read it from disk since devices
are suspended.)  The lvmcache vginfo struct is used as a
convenient place to stash the VG to pass it from suspend
to resume, even though it isn't related to the lvmcache
or vginfo.  These suspended_vg* vginfo fields should
not be used or touched anywhere else, they are only to
be used for passing the VG data from suspend to resume
in clvmd.  The VG data being passed between suspend and
resume is never modified, and will only exist in the
brief period between suspend and resume in clvmd.

suspend has both old (current) and new (precommitted)
copies of the VG metadata.  It stashes both of these in
the vginfo prior to suspending devices.  When vg_commit
is successful, it sets a flag in vginfo as before,
signaling the transition from old to new metadata.

resume grabs the VG stashed by suspend.  If the vg_commit
happened, it grabs the new VG, and if the vg_commit didn't
happen it grabs the old VG.  The VG is then used to resume
LVs.

This isolates clvmd-specific code and usage from the
normal lvm vg_read code, making the code simpler and
the behavior easier to verify.

Sequence of operations:

- lv_suspend() has both vg_old and vg_new
  and stashes a copy of each onto the vginfo:
  lvmcache_save_suspended_vg(vg_old);
  lvmcache_save_suspended_vg(vg_new);

- vg_commit() happens, which causes all clvmd
  instances to call lvmcache_commit_metadata(vg).
  A flag is set in the vginfo indicating the
  transition from the old to new VG:
  vginfo->suspended_vg_committed = 1;

- lv_resume() needs either vg_old or vg_new
  to use in resuming LVs.  It doesn't want to
  read the VG from disk since devices are
  suspended, so it gets the VG stashed by
  lv_suspend:
  vg = lvmcache_get_suspended_vg(vgid);

If the vg_commit did not happen, suspended_vg_committed
will not be set, and in this case, lvmcache_get_suspended_vg()
will return the old VG instead of the new VG, and it will
resume LVs based on the old metadata.
2018-04-20 11:22:45 -05:00
autoconf autoconf: Fix py-compile permissions 2016-02-18 01:05:05 +00:00
conf [io paths] Unpick agk's aio stuff 2018-04-20 11:03:58 -05:00
coverity coverity: model few more functions 2017-06-27 12:17:16 +02:00
daemons [makefile] add -laio to makefiles 2018-04-20 11:13:17 -05:00
doc [io paths] Unpick agk's aio stuff 2018-04-20 11:03:58 -05:00
include [device/bcache] stub a unit test 2018-04-20 11:12:50 -05:00
lib lvmcache: simplify metadata cache 2018-04-20 11:22:45 -05:00
libdaemon tidy: Add missing underscores to statics. 2017-10-18 15:58:13 +01:00
libdm cleanup: call uname once 2018-04-20 12:16:58 +02:00
liblvm [makefile] add -laio to makefiles 2018-04-20 11:13:17 -05:00
man [build] Quieten the build down 2018-04-20 11:10:45 -05:00
nix lockd: Clean up spec 2015-07-04 14:36:57 +02:00
po doc: change fsf address 2016-01-21 12:11:37 +01:00
python python: add devmapper library to linking 2018-02-09 11:00:18 +01:00
report-generators doc: change fsf address 2016-01-21 12:11:37 +01:00
reports [REPORT-GENERATORS] cut down stylsheet.css to what we actually use 2010-07-21 10:00:38 +00:00
scripts [makefile] add -laio to makefiles 2018-04-20 11:13:17 -05:00
spec spec: Enable notify-dbus in builds with dbus 2017-05-26 07:40:09 +02:00
test [device/bcache] more work on bcache 2018-04-20 11:12:50 -05:00
tools lvmcache: simplify metadata cache 2018-04-20 11:22:45 -05:00
udev udev: keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd reload 2018-04-17 11:38:12 +02:00
.gitignore [git] Update .gitignore 2018-04-20 11:11:56 -05:00
acinclude.m4 configure: just move new macro to right file 2016-12-13 22:49:59 +01:00
aclocal.m4 [lib/device/bcache] Tweaks after Kabi's review 2018-04-20 11:10:45 -05:00
configure [unit tests] remove old unit tests that weren't built or run. 2018-04-20 11:10:46 -05:00
configure.in [unit tests] remove old unit tests that weren't built or run. 2018-04-20 11:10:46 -05:00
COPYING doc: change fsf address 2016-01-21 12:11:37 +01:00
COPYING.LIB Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
INSTALL quick review of docs 2008-11-04 17:49:22 +00:00
make.tmpl.in [build] Quieten the build down 2018-04-20 11:10:45 -05:00
Makefile.in [build] include test/unit/Makefile rather than recursive build 2018-04-20 11:12:50 -05:00
README README: Include new github links 2017-09-13 20:20:04 +01:00
TESTING docs: Add TESTING file 2017-12-14 16:45:47 +01:00
VERSION post-release 2017-12-18 20:43:09 +00:00
VERSION_DM post-release 2017-12-18 20:43:09 +00:00
WHATS_NEW mirror: validate region_size for mirrors 2018-04-20 12:16:13 +02:00
WHATS_NEW_DM cleanup: call uname once 2018-04-20 12:16:58 +02:00

This tree contains the LVM2 and device-mapper tools and libraries.

For more information about LVM2 read the changelog in the WHATS_NEW file.
Installation instructions are in INSTALL.

There is no warranty - see COPYING and COPYING.LIB.

Tarballs are available from:
  ftp://sourceware.org/pub/lvm2/
  ftp://sources.redhat.com/pub/lvm2/
  https://github.com/lvmteam/lvm2/releases

The source code is stored in git:
  https://sourceware.org/git/?p=lvm2.git
  git clone git://sourceware.org/git/lvm2.git
mirrored to:
  https://github.com/lvmteam/lvm2
  git clone https://github.com/lvmteam/lvm2.git
  git clone git@github.com:lvmteam/lvm2.git

Mailing list for general discussion related to LVM2:
  linux-lvm@redhat.com
  Subscribe from https://www.redhat.com/mailman/listinfo/linux-lvm

Mailing lists for LVM2 development, patches and commits:
  lvm-devel@redhat.com
  Subscribe from https://www.redhat.com/mailman/listinfo/lvm-devel

  lvm2-commits@lists.fedorahosted.org (Read-only archive of commits)
  Subscribe from https://fedorahosted.org/mailman/listinfo/lvm2-commits

Mailing list for device-mapper development, including kernel patches
and multipath-tools:
  dm-devel@redhat.com
  Subscribe from https://www.redhat.com/mailman/listinfo/dm-devel

Website:
  https://sourceware.org/lvm2/

Report upstream bugs at:
  https://bugzilla.redhat.com/enter_bug.cgi?product=LVM%20and%20device-mapper
or open issues at:
  https://github.com/lvmteam/lvm2/issues

The source code repository used until 7th June 2012 is accessible here:
  http://sources.redhat.com/cgi-bin/cvsweb.cgi/LVM2/?cvsroot=lvm2.