From 4b1687fb7462482f9336b38918fd94dc75f0f7b0 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Tue, 5 Jan 2010 16:01:22 +0000 Subject: [PATCH] Do not set precommitted flag in cache when precommitted metadata does not exist. The use_precommitted flag indicates, that we want to use precommitted metadata (used in suspend call to preload table with precommitted data). But if there are no such data, committed metadata are read but the cache still contains that precommitted flag. (The problem is that later possible drop_metadata call will not invalidate device in cache.) The wrong precommitted state is stored in on remote nodes during normal suspend/resume cycle _without_ vg_write/commit. Use the PRECOMMITTED status flag here instead (which is always set if using precommited metadata here). --- WHATS_NEW | 1 + lib/metadata/metadata.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 8d2588f70..b8a5135c5 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.57 - ==================================== + Properly handle precommitted flag in cache when commited data only present. Resume renamed volumes in reverse order to preserve memlock pairing. Drop metadata cache after device was autorepaired and removed from VG. Remove missing flag in metadata if PV reappeared and is empty. diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index f2ff8acef..7136e209a 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -2620,7 +2620,11 @@ static struct volume_group *_vg_read(struct cmd_context *cmd, if (!inconsistent_pvs) { log_debug("Updating cache for PVs without mdas " "in VG %s.", vgname); - lvmcache_update_vg(correct_vg, use_precommitted); + /* + * If there is no precommitted metadata, committed metadata + * is read and stored in the cache even if use_precommitted is set + */ + lvmcache_update_vg(correct_vg, correct_vg->status & PRECOMMITTED); if (!(pvids = lvmcache_get_pvids(cmd, vgname, vgid))) return_NULL; @@ -2721,7 +2725,11 @@ static struct volume_group *_vg_read(struct cmd_context *cmd, return_NULL; } - lvmcache_update_vg(correct_vg, use_precommitted); + /* + * If there is no precommitted metadata, committed metadata + * is read and stored in the cache even if use_precommitted is set + */ + lvmcache_update_vg(correct_vg, correct_vg->status & PRECOMMITTED); if (inconsistent) { /* FIXME Test should be if we're *using* precommitted metadata not if we were searching for it */