1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

clvmd: fix valgrind warning

Initialize mutex upfront any debugging and fix this report:

Mutex reinitialization: mutex 0x485d20, recursion count 0, owner 1.
   at 0x4C38480: pthread_mutex_init_intercept (drd_pthread_intercepts.c:821)
   by 0x4C38480: pthread_mutex_init (drd_pthread_intercepts.c:830)
   by 0x11F359: main (clvmd.c:562)
mutex 0x485d20 was first observed at:
   at 0x4C38F63: pthread_mutex_lock_intercept (drd_pthread_intercepts.c:885)
   by 0x4C38F63: pthread_mutex_lock (drd_pthread_intercepts.c:898)
   by 0x11E920: debuglog (clvmd.c:254)
   by 0x11F1D8: main (clvmd.c:527)
This commit is contained in:
Zdenek Kabelac 2017-07-17 12:23:37 +02:00
parent ea96a9d68e
commit d7f92ea8ee
2 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.173 - Version 2.02.173 -
================================= =================================
Initialize debugging mutex before any debug message in clvmd.
Log error instad of warn when noticing connection problem with lvmetad. Log error instad of warn when noticing connection problem with lvmetad.
Fix memory leak in lvmetad when working with duplicates. Fix memory leak in lvmetad when working with duplicates.
Accept 'lvm -h' and 'lvm --help' as well as 'lvm help' for help. Accept 'lvm -h' and 'lvm --help' as well as 'lvm help' for help.

View File

@ -124,7 +124,7 @@ static const size_t STACK_SIZE = 128 * 1024;
static pthread_attr_t stack_attr; static pthread_attr_t stack_attr;
static int lvm_thread_exit = 0; static int lvm_thread_exit = 0;
static pthread_mutex_t lvm_thread_mutex; static pthread_mutex_t lvm_thread_mutex;
static pthread_mutex_t _debuglog_mutex; static pthread_mutex_t _debuglog_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t lvm_thread_cond; static pthread_cond_t lvm_thread_cond;
static pthread_barrier_t lvm_start_barrier; static pthread_barrier_t lvm_start_barrier;
static struct dm_list lvm_cmd_head; static struct dm_list lvm_cmd_head;
@ -559,7 +559,6 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
pthread_mutex_init(&lvm_thread_mutex, NULL); pthread_mutex_init(&lvm_thread_mutex, NULL);
pthread_mutex_init(&_debuglog_mutex, NULL);
pthread_cond_init(&lvm_thread_cond, NULL); pthread_cond_init(&lvm_thread_cond, NULL);
pthread_barrier_init(&lvm_start_barrier, NULL, 2); pthread_barrier_init(&lvm_start_barrier, NULL, 2);
init_lvhash(); init_lvhash();