1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/liblvm
David Teigland a7c45ddc59 lvmetad: two phase vg_update
Previously, a command sent lvmetad new VG metadata in vg_commit().
In vg_commit(), devices are suspended, so any memory allocation
done by the command while sending to lvmetad, or by lvmetad while
updating its cache could deadlock if memory reclaim was triggered.

Now lvmetad is updated in unlock_vg(), after devices are resumed.
The new method for updating VG metadata in lvmetad is in two phases:

1. In vg_write(), before devices are suspended, the command sends
   lvmetad a short message ("set_vg_info") telling it what the new
   VG seqno will be.  lvmetad sees that the seqno is newer than
   the seqno of its cached VG, so it sets the INVALID flag for the
   cached VG.  If sending the message to lvmetad fails, the command
   fails before the metadata is committed and the change is not made.
   If sending the message succeeds, vg_commit() is called.

2. In unlock_vg(), after devices are resumed, the command sends
   lvmetad the standard vg_update message with the new metadata.
   lvmetad sees that the seqno in the new metadata matches the
   seqno it saved from set_vg_info, and knows it has the latest
   copy, so it clears the INVALID flag for the cached VG.

If a command fails between 1 and 2 (after committing the VG on disk,
but before sending lvmetad the new metadata), the cached VG retains
the INVALID flag in lvmetad.  A subsequent command will read the
cached VG from lvmetad, see the INVALID flag, ignore the cached
copy, read the VG from disk instead, update the lvmetad copy
with the latest copy from disk, (this clears the INVALID flag
in lvmetad), and use the correct VG metadata for the command.

(This INVALID mechanism already existed for use by lvmlockd.)
2016-06-28 02:30:31 +01:00
..
.exported_symbols Generate liblvm2app and libdevmapper exported symbols from header files. 2010-06-25 18:17:38 +00:00
Doxyfile Add Doxygen file for lvm2app to generate documentation from lvm2app.h. 2010-02-24 18:16:54 +00:00
liblvm2app.pc.in configure: add --enable-blkid_wiping 2013-11-27 15:48:16 +01:00
lvm2app.h doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm_base.c liblvm: allow config settings to be read without full lvm cmd 2016-05-18 09:04:25 -05:00
lvm_lv.c cleanup: drop setting lv_name 2016-06-23 14:59:29 +02:00
lvm_misc.c doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm_misc.h doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm_prop_fields.h doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm_prop.c redefine pvcreate structs 2016-02-25 09:14:10 -06:00
lvm_prop.h doc: change fsf address 2016-01-21 12:11:37 +01:00
lvm_pv.c lvmetad: two phase vg_update 2016-06-28 02:30:31 +01:00
lvm_vg.c lvmetad: two phase vg_update 2016-06-28 02:30:31 +01:00
Makefile.in doc: change fsf address 2016-01-21 12:11:37 +01:00