I am using based on OpenIPMI library ipmi module in collectd . And in some
cases I have watched interlock OpenIPMI library threads. Interlock have
been here:

Thread 5 (Thread 0x2b2909116700 (LWP 19188)):
#0  0x0000003b9540e264 in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x0000003b95409508 in _L_lock_854 () from /lib64/libpthread.so.0
#2  0x0000003b954093d7 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3  0x00002b2906320284 in lock (handler=<value optimized out>,
id=0x2b290c00b6d0) at posix_thread_os_hnd.c:445
#4  0x00002b2906772498 in _ipmi_domain_get (domain=0x2b290c00d3a0) at
domain.c:1313
#5  0x00002b29067727c1 in ipmi_domain_pointer_cb (id=<value optimized out>,
handler=0x2b290677f060 <mc_ptr_cb>, cb_data=0x2b2909115d50) at domain.c:4033
#6  0x00002b290677d6bd in ipmi_mc_pointer_cb (id=..., handler=<value
optimized out>, cb_data=<value optimized out>) at mc.c:2610
#7  0x00002b2906795a92 in ipmi_sensor_pointer_cb (id=..., handler=<value
optimized out>, cb_data=<value optimized out>) at sensor.c:390
#8  0x00002b2906795b56 in ipmi_sensor_id_get_reading (sensor_id=...,
done=<value optimized out>, cb_data=<value optimized out>) at sensor.c:5915
#9  0x00002b2906115851 in sensor_list_read_all () at ipmi.c:522
#10 c_ipmi_read () at ipmi.c:775
#11 0x000000000041bbe2 in plugin_read_thread (args=<value optimized out>)
at plugin.c:526
#12 0x0000003b954079d1 in start_thread () from /lib64/libpthread.so.0
#13 0x0000003b950e8b6d in clone () from /lib64/libc.so.6

This bug is saved in openipmi-2.0.21 and we fixed it.


patch to fix it

--- unix/posix_thread_os_hnd.c 2013-10-10 23:09:17.000000000 +0400
+++ unix/posix_thread_os_hnd.c 2015-05-21 20:54:45.000000000 +0300
@@ -439,12 +439,9 @@ static int
 lock(os_handler_t  *handler,
      os_hnd_lock_t *id)
 {
-    int rv;
-
-    if ((id->lock_count == 0) || (pthread_self() != id->owner)) {
- rv = pthread_mutex_lock(&id->mutex);
- if (rv)
-    return rv;
+    int rv = pthread_mutex_lock(&id->mutex);
+    if (rv) {
+        return rv;
     }
     id->owner = pthread_self();
     id->lock_count++;
@@ -462,12 +459,10 @@ unlock(os_handler_t  *handler,
     if (pthread_self() != id->owner)
  handler->log(handler, IPMI_LOG_FATAL, "lock release by non-owner");
     id->lock_count--;
-    if (id->lock_count == 0) {
- rv = pthread_mutex_unlock(&id->mutex);
- if (rv) {
-    id->lock_count++;
-    return rv;
- }
+    rv = pthread_mutex_unlock(&id->mutex);
+    if (rv) {
+        id->lock_count++;
+        return rv;
     }
     return 0;
 }
------------------------------------------------------------------------------
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer

Reply via email to