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

Fix missing thread list manipulation

For manipulation with thread list to avoid race with timeout thread,
take also _timeout_mutex.
This commit is contained in:
Zdenek Kabelac 2011-12-21 13:03:06 +00:00
parent 1b9a70b6af
commit b0f1e29335
2 changed files with 5 additions and 0 deletions

View File

@ -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.

View 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();