mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
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).