From 8deeeb07ea7b6c178791e7b57d45d8484b87b28a Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 18 Nov 2011 19:28:00 +0000 Subject: [PATCH] Unlock memory for vg_write For write we do not need to hold memory locked. This relaxes many conditions and avoid problems when allocating a lot of memory for writting metadata buffers. (In case of huge MDA size this would lead to mismatch between locked and unlocked memory region size). Add also internal check we are not writing in critical section. --- WHATS_NEW | 1 + lib/metadata/metadata.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 6fd7414e1..169beee2e 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.89 - ================================== + Unlock memory before writing metadata. Add query before removing snapshots when inactive snapshot origin is removed. Allow changing availability state of snapshots. Skip non-virtual snapshots for availability change for lvchange with vg name. diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 4037c0e6f..7ab06c0bd 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -2573,6 +2573,12 @@ int vg_write(struct volume_group *vg) return 0; } + if (critical_section()) + log_error(INTERNAL_ERROR + "Writing metadata in critical section."); + + /* Unlock memory if possible */ + memlock_unlock(vg->cmd); vg->seqno++; dm_list_iterate_items(pv_to_create, &vg->pvs_to_create) {