1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-17 06:04:23 +03:00

When activating, if precommitted metadata is still cached, assume it's live.

This commit is contained in:
Alasdair Kergon 2008-06-05 13:06:39 +00:00
parent 4bfa132445
commit e4b34bfad0
3 changed files with 24 additions and 3 deletions

View File

@ -9,6 +9,7 @@ Version 2.02.38 -
Version 2.02.37 -
=================================
When activating, if precommitted metadata is still cached, assume it's live.
When removing LV symlinks, skip any where the VG name is not determined.
Drop metadata cache if update fails in vg_revert or vg_commit.
Avoid spurious duplicate VG messages referring to VGs that are gone.

View File

@ -993,7 +993,11 @@ int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s,
if (!activation())
goto activate;
if (!(lv = lv_from_lvid(cmd, lvid_s, 0)))
/*
* If we're activating and precommitted metadata is still cached,
* we assume it matches the new live metadata.
*/
if (!(lv = lv_from_lvid(cmd, lvid_s, 1)))
return 0;
if (!_passes_activation_filter(cmd, lv)) {
@ -1018,7 +1022,11 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
if (!activation())
return 1;
if (!(lv = lv_from_lvid(cmd, lvid_s, 0)))
/*
* If we're activating and precommitted metadata is still cached,
* we assume it matches the new live metadata.
*/
if (!(lv = lv_from_lvid(cmd, lvid_s, 1)))
return 0;
if (filter && !_passes_activation_filter(cmd, lv)) {

14
lib/cache/lvmcache.c vendored
View File

@ -479,8 +479,20 @@ struct volume_group *lvmcache_get_vg(const char *vgid, unsigned precommitted)
if (!_vginfo_is_valid(vginfo))
return NULL;
/*
* Don't return cached data if either:
* (i) precommitted metadata is requested but we don't have it cached
* - caller should read it off disk;
* (ii) live metadata is requested but we have precommitted metadata cached
* and no devices are suspended so caller may read it off disk.
*
* If live metadata is requested but we have precommitted metadata cached
* and devices are suspended, we assume this precommitted metadata has
* already been preloaded and committed so it's OK to return it as live.
* Note that we do not clear the PRECOMMITTED flag.
*/
if ((precommitted && !vginfo->precommitted) ||
(!precommitted && vginfo->precommitted))
(!precommitted && vginfo->precommitted && !memlock()))
return NULL;
if (!(fid = vginfo->fmt->ops->create_instance(vginfo->fmt,