1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
lvm2/lib/format_text
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
..
archive.c doc: change fsf address 2016-01-21 12:11:37 +01:00
archiver.c lvmetad: two phase vg_update 2016-06-28 02:30:31 +01:00
archiver.h vgcfgrestore: use lvmetad disabled state 2016-06-20 11:19:49 -05:00
export.c coverity: fix possible resource leak of descendants_buffer in _print_historical_lv fn 2016-05-31 09:36:58 +02:00
flags.c doc: change fsf address 2016-01-21 12:11:37 +01:00
format-text.c lvmcache: add optional dev arg to lvmcache_info_from_pvid 2016-06-07 15:15:47 -05:00
format-text.h doc: change fsf address 2016-01-21 12:11:37 +01:00
import_vsn1.c debug: use display_lvname 2016-05-19 18:40:14 +02:00
import-export.h rename function read_vgname to read_vgsummary 2016-04-11 13:07:48 -05:00
import.c rename function read_vgname to read_vgsummary 2016-04-11 13:07:48 -05:00
layout.h metadata: introduce PV_EXT_USED flag and bump PV_HEADER_EXTENSION_VSN 2016-02-15 12:44:46 +01:00
text_export.h coverity: fix possible resource leak of descendants_buffer in _print_historical_lv fn 2016-05-31 09:36:58 +02:00
text_import.h doc: change fsf address 2016-01-21 12:11:37 +01:00
text_label.c lvmcache/lvmetad: cache PV extension version 2016-02-15 12:44:46 +01:00