OpenAFS Master Repository branch, master, updated. openafs-devel-1_5_76-3076-g3898f4d

Gerrit Code Review gerrit@openafs.org
Tue, 30 Oct 2012 04:59:58 -0700 (PDT)


The following commit has been merged in the master branch:
commit 3898f4d20500fbdbe60e36ecaf6b80f96913b84c
Author: Simon Wilkinson <sxw@your-file-system.com>
Date:   Sun Oct 21 20:07:44 2012 +0100

    Fix mutex assertion
    
    RX mutexes have two mechanisms for asserting ownership of a mutex:
    MUTEX_ISMINE, which returns true if the caller is the owner of the
    mutex in question, and osirx_AssertMutex which fires an assertion if
    the calling thread doesn't own a specified mutex.
    
    Neither of these work with pthread mutexes on all platforms, and the
    kernel support for MUTEX_ISMINE is dubious in places. Because in some
    implementations, MUTEX_ISMINE tries to lock the mutex in question, a
    failing call to MUTEX_ISMINE can lead to the process holding an
    additional, unexpected, lock.
    
    This patch reworks all of this, and uses the new opr mutex framework
    so that we can do mutex assertions in userspace, too. We remove the
    unsafe MUTEX_ISMINE macro, and replace it with MUTEX_ASSERT which
    simply asserts if the specified mutex is not held by the current
    thread. osirx_AssertMutex is removed as it is now redundant.
    MUTEX_ASSERT will always work in kernel code.
    
    For userspace, we provide opr_mutex_assert, which is implemented using
    POSIX error checking mutexes. As error checking mutexes have a runtime
    overhead, this is only available when configured with
    --enable-debug-locks, the rest of the time calls to opr_mutex_assert are
    no-ops.
    
    Change-Id: I285ee2b558389fa3d63b786e4bc4420fa2126c80
    Reviewed-on: http://gerrit.openafs.org/8282
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>

 acinclude.m4               |    9 +++++++++
 src/opr/lockstub.h         |    1 +
 src/opr/opr_lock.h         |   26 +++++++++++++++++++++++++-
 src/rx/AIX/rx_kmutex.h     |    6 +-----
 src/rx/DARWIN/rx_kmutex.h  |    9 ++-------
 src/rx/FBSD/rx_kmutex.h    |   16 ++++------------
 src/rx/HPUX/rx_kmutex.h    |    8 ++------
 src/rx/IRIX/rx_kmutex.h    |    9 ++-------
 src/rx/LINUX/rx_kmutex.h   |    6 +++---
 src/rx/LINUX24/rx_kmutex.h |    6 +++---
 src/rx/NBSD/rx_kmutex.h    |    6 +++---
 src/rx/OBSD/rx_kmutex.h    |    2 +-
 src/rx/SOLARIS/rx_kmutex.h |    5 +----
 src/rx/UKERNEL/rx_kmutex.h |    6 +-----
 src/rx/rx.c                |   24 ++++++------------------
 src/rx/rx_lwp.h            |    3 +--
 src/rx/rx_prototypes.h     |    3 ---
 src/rx/rx_pthread.h        |   22 ++--------------------
 src/vol/vutil.c            |    2 +-
 19 files changed, 68 insertions(+), 101 deletions(-)

-- 
OpenAFS Master Repository