]> sourceware.org Git - lvm2.git/commitdiff
dmeventd: drop taking timeout mutex
authorZdenek Kabelac <zkabelac@redhat.com>
Sun, 30 Jun 2013 14:06:39 +0000 (16:06 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 12 Dec 2013 12:32:49 +0000 (13:32 +0100)
Taking _timeout_mutex is not needed when registering and unregistering.
Global mutex is already being hold for this case.

WHATS_NEW_DM
daemons/dmeventd/dmeventd.c

index b737a3e047917674db338ae0f43127232dc79867..97c3c43048648de022adf1ae30aae9a542997237 100644 (file)
@@ -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.
index f2d6671bfb1bac9ccf3c179c5e922797bd5b3d86..47a341e055def2ac121d4ca9644749ce2b3a8671 100644 (file)
@@ -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();
 
This page took 0.044686 seconds and 5 git commands to generate.