mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
locking: move cache dropping to primary locking code
While 'file-locking' code always dropped cached VG before lock was taken - other locking types actually missed this. So while the cache dropping has been implement for i.e. clvmd, actually running command in cluster keept using cache even when the lock has been i.e. dropped and taken again. This rather 'hard-to-hit' error was noticable in some tests running in cluster where content of PV has been changed (metadata-balance.sh) Fix the code by moving cache dropping directly lock_vol() function. TODO: it's kind of strange we should ever need drop_cached_metadata() used in several places - this all should happen automatically this some futher thinking here is likely needed.
This commit is contained in:
parent
e87fa7c9ce
commit
c3bb2b29d4
@ -1,5 +1,6 @@
|
||||
Version 2.02.178 -
|
||||
=====================================
|
||||
Ensure cluster commands drop their device cache before locking VG.
|
||||
Do not report LV as remotely active when it's locally exclusive in cluster.
|
||||
Add deprecate messages for usage of mirrors with mirrorlog.
|
||||
Separate reporting of monitoring status and error status.
|
||||
|
@ -60,11 +60,8 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
|
||||
return_0;
|
||||
break;
|
||||
case LCK_VG:
|
||||
if (!strcmp(resource, VG_SYNC_NAMES)) {
|
||||
if (!strcmp(resource, VG_SYNC_NAMES))
|
||||
fs_unlock();
|
||||
} else if (strcmp(resource, VG_GLOBAL))
|
||||
/* Skip cache refresh for VG_GLOBAL - the caller handles it */
|
||||
lvmcache_drop_metadata(resource, 0);
|
||||
|
||||
/* LCK_CACHE does not require a real lock */
|
||||
if (flags & LCK_CACHE)
|
||||
|
@ -336,6 +336,13 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags, const str
|
||||
!lvmcache_verify_lock_order(vol))
|
||||
return_0;
|
||||
|
||||
if ((flags == LCK_VG_DROP_CACHE) ||
|
||||
(strcmp(vol, VG_GLOBAL) && strcmp(vol, VG_SYNC_NAMES))) {
|
||||
/* Skip dropping cache for internal VG names #global, #sync_names */
|
||||
log_debug_locking("Dropping cache for %s.", vol);
|
||||
lvmcache_drop_metadata(vol, 0);
|
||||
}
|
||||
|
||||
/* Lock VG to change on-disk metadata. */
|
||||
/* If LVM1 driver knows about the VG, it can't be accessed. */
|
||||
if (!check_lvm1_vg_inactive(cmd, vol))
|
||||
|
Loading…
Reference in New Issue
Block a user