1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

metadata: Fix a pool CRC failure due to "late" ondisk copy creation.

This commit is contained in:
Petr Rockai 2013-03-18 15:46:00 +01:00 committed by Petr Rockai
parent df4c0bedfb
commit 2cce2f67ab

View File

@ -837,12 +837,21 @@ static int _vg_update_vg_ondisk(struct volume_group *vg)
if (vg->vg_ondisk) /* we already have it */ if (vg->vg_ondisk) /* we already have it */
return 1; return 1;
int pool_locked = dm_pool_locked(vg->vgmem);
if (pool_locked && !dm_pool_unlock(vg->vgmem, 0))
return_0;
cft = export_vg_to_config_tree(vg); cft = export_vg_to_config_tree(vg);
if (!cft) if (!cft)
return 0; return 0;
vg->vg_ondisk = import_vg_from_config_tree(cft, vg->fid); vg->vg_ondisk = import_vg_from_config_tree(cft, vg->fid);
dm_config_destroy(cft); dm_config_destroy(cft);
/* recompute the pool crc */
if (pool_locked && !dm_pool_lock(vg->vgmem, detect_internal_vg_cache_corruption()))
return_0;
return 1; return 1;
} }