From 1fa81251258a55139f604320b975a6cdacd4082a Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 30 Mar 2011 12:43:32 +0000 Subject: [PATCH] Valgrind updates Avoid locking sum testing with valgrind compilation. Make memory unaccessible in the valgrind for dm_pool_abadon_object. Valgrind hinting should not be needed in _free_chunk for dm_free. --- WHATS_NEW | 1 + lib/mm/memlock.c | 8 ++++++++ libdm/mm/pool-fast.c | 11 ++++------- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 2595bfe3d..f118a6215 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.85 - =================================== + Enhance usability with the valgrind memcheck tool. Support regular quit of the lvm_thread_fn function in clvmd. Fix reading of unallocated memory in lvm1 format import function. Replace several strncmp() calls with id_equal(). diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c index 3e472bda8..1dd0172dc 100644 --- a/lib/mm/memlock.c +++ b/lib/mm/memlock.c @@ -195,6 +195,14 @@ static int _maps_line(const struct config_node *cn, lvmlock_t lock, } } +#ifdef VALGRIND_POOL + /* + * Valgrind is continually eating memory while executing code + * so we need to deactivate check of locked memory size + */ + sz -= sz; /* = 0, but avoids getting warning about dead assigment */ + +#endif *mstats += sz; log_debug("%s %10ldKiB %12lx - %12lx %c%c%c%c%s", (lock == LVM_MLOCK) ? "mlock" : "munlock", diff --git a/libdm/mm/pool-fast.c b/libdm/mm/pool-fast.c index 377ad99ca..b651449f8 100644 --- a/libdm/mm/pool-fast.c +++ b/libdm/mm/pool-fast.c @@ -238,6 +238,9 @@ void *dm_pool_end_object(struct dm_pool *p) void dm_pool_abandon_object(struct dm_pool *p) { +#ifdef VALGRIND_POOL + VALGRIND_MAKE_MEM_NOACCESS(p->chunk, p->object_len); +#endif p->object_len = 0; p->object_alignment = DEFAULT_ALIGNMENT; } @@ -278,11 +281,5 @@ static struct chunk *_new_chunk(struct dm_pool *p, size_t s) static void _free_chunk(struct chunk *c) { - if (c) { -#ifdef VALGRIND_POOL - VALGRIND_MAKE_MEM_UNDEFINED(c, c->end - (char *) c); -#endif - - dm_free(c); - } + dm_free(c); } -- 2.43.5