• Sergey Vojtovich's avatar
    Backport from 10.0: · c01c8192
    Sergey Vojtovich authored
    MDEV-6483 - Deadlock around rw_lock_debug_mutex on PPC64
    
    This problem affects only debug builds on PPC64.
    
    There are at least two race conditions around
    rw_lock_debug_mutex_enter and rw_lock_debug_mutex_exit:
    
    - rw_lock_debug_waiters was loaded/stored without setting
      appropriate locks/memory barriers.
    - there is a gap between calls to os_event_reset() and
      os_event_wait() and in such case we're supposed to pass
      return value of the former to the latter.
    
    Fixed by replacing self-cooked spinlocks with system mutexes.
    These days system mutexes offer much better performance. OTOH
    performance is not that critical for debug builds.
    c01c8192
sync0rw.h 30.5 KB