Skip to contentSkip to conversation

master - metadata: fix automatic updates of PV extension headers to newest version

PATCH Peter Rajnoha 1 participant 1 message Jul 26, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=070c0d31ab3847240081e7593f959b03e716923d
Commit:        070c0d31ab3847240081e7593f959b03e716923d
Parent:        f9697ea0067ef574aff09f1c8f25e1c7fab74c17
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Tue Jul 26 15:46:36 2016 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Tue Jul 26 16:22:55 2016 +0200

metadata: fix automatic updates of PV extension headers to newest version

Before, the automatic update from older to newer version of PV extension header happened within vg_write call. This may have caused problems under some circumnstances where there's a code in between vg_write and vg_commit which may have failed. In such situation, we reverted precommitted metadata and put back the state to working version of VG metadata.

However, we don't have revert for PV write operation at the moment. So if we updated PV headers already and we reverted vg_write due to failure in subsequent code (before vg_commit), we ended up with lost VG metadata (because old metadata pointers got reset by the PV write operation).

To minimize problematic situations here, we should put vg_write and vg_commit that is done after PV header rewrites as close to each other as possible.

This patch moves the automatic PV header rewrite for new extension header part from vg_write to _vg_read where it's done the same way as we do any other VG repairs if detected during VG read operation (under VG write lock).

---
 WHATS_NEW               |    1 +
 lib/metadata/metadata.c |   43 +++++++++++++++++++++++++++++++++----------
 2 files changed, 34 insertions(+), 10 deletions(-)
WHATS_NEW +1 -0
index c96b5be..4f24476 100644
@@ -1,5 +1,6 @@
 Version 2.02.162 - 
 =================================
+  Fix automatic updates of PV extension headers to newest version.
   Improve lvconvert --trackchanges validation to require --splitmirrors 1.
   Add note about lastlog built-in command to lvm man page.
   Fix unrecognised segtype flag message.
lib/metadata/metadata.c +33 -10

82 lines not on this page · raw message