]> sourceware.org Git - lvm2.git/commitdiff
Fix missing thread list manipulation
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 21 Dec 2011 13:03:06 +0000 (13:03 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 21 Dec 2011 13:03:06 +0000 (13:03 +0000)
For manipulation with thread list to avoid race with timeout thread,
take also _timeout_mutex.

WHATS_NEW
daemons/dmeventd/dmeventd.c

index e5efb7a295c0339e35c08e7b8700d226b002a161..284064c280966f0cd4a0a1dd2a7071544c5ba06a 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Fix missing thread list manipulation protection in dmeventd.
   Do not derefence lv pointer in _percent_run() function before NULL check.
   Allow empty strings for description and creation_host config fields.
   Issue deprecation warning when removing last lvm1-format snapshot.
index 027c2e136a6f4843a771f2695075c342d5159837..b26faf858e7caf6229e550fd2d05b3a34a6ba0c6 100644 (file)
@@ -739,8 +739,10 @@ 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();
 }
 
@@ -1078,8 +1080,10 @@ static int _unregister_for_event(struct message_data *message_data)
         * 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.044123 seconds and 5 git commands to generate.