From: Zdenek Kabelac Date: Sun, 30 Jun 2013 14:06:39 +0000 (+0200) Subject: dmeventd: drop taking timeout mutex X-Git-Tag: v2_02_105~62 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=4fc97980b6e0f31c04d0325cd7ac4e84cdc58cc6;p=lvm2.git dmeventd: drop taking timeout mutex Taking _timeout_mutex is not needed when registering and unregistering. Global mutex is already being hold for this case. --- diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index b737a3e04..97c3c4304 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.84 - ==================================== + Drop taking timeout mutex for un/registering dmeventd monitor. Allow section names in config file data to be quoted strings. Close fifos before exiting in dmeventd restart() error path. Move printf format string directly into dm_asprintf args list. diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c index f2d6671bf..47a341e05 100644 --- a/daemons/dmeventd/dmeventd.c +++ b/daemons/dmeventd/dmeventd.c @@ -751,10 +751,8 @@ static void _monitor_unregister(void *arg) return; } thread->status = DM_THREAD_DONE; - pthread_mutex_lock(&_timeout_mutex); UNLINK_THREAD(thread); LINK(thread, &_thread_registry_unused); - pthread_mutex_unlock(&_timeout_mutex); _unlock_mutex(); } @@ -1083,17 +1081,18 @@ static int _unregister_for_event(struct message_data *message_data) thread->events &= ~message_data->events_field; - if (!(thread->events & DM_EVENT_TIMEOUT)) + if (!(thread->events & DM_EVENT_TIMEOUT)) { + _unlock_mutex(); _unregister_for_timeout(thread); + _lock_mutex(); + } /* * In case there's no events to monitor on this device -> * unlink and terminate its monitoring thread. */ if (!thread->events) { - pthread_mutex_lock(&_timeout_mutex); UNLINK_THREAD(thread); LINK(thread, &_thread_registry_unused); - pthread_mutex_unlock(&_timeout_mutex); } _unlock_mutex();