OpenAFS Master Repository branch, master, updated. openafs-devel-1_9_1-111-g0abef57
Gerrit Code Review
gerrit@openafs.org
Thu, 21 Oct 2021 12:27:31 -0400
The following commit has been merged in the master branch:
commit 0abef5765c8e8ec427588c37c772ab448e7ed5a0
Author: Andrew Deason <adeason@dson.org>
Date: Sat May 2 20:56:46 2020 -0500
FBSD: use sx(9) locks for rx afs_kmutex_t
On FBSD, afs_kmutex_t is defined as a struct mtx, which is a
non-sleepable lock. If we hold one of these locks and then try to
acquire a sleepable lock, there is the potential for deadlock, and
WITNESS complains.
One way this is a problem is that we acquire IFNET_RLOCK in
rxi_GetIFInfo(), which is a sleepable lock. We enter this function
via rxi_FindPeer -> rxi_InitPeerParams, which is encountered while
holding a variety of different Rx locks in different situations, such
as rx_peerHashTable_lock and rx_connHashTable_lock.
Another way this is a problem is that we allocate memory in a variety
of situations whole holding various Rx locks. Currently many of these
are sleepable allocations (which could cause deadlocks); we could
avoid that if they were converted to non-sleepable allocations, but
then the allocations may fail and we'd need to adjust all of the
relevant code paths to accommodate.
To avoid these issues, define Rx's afs_kmutex_t locks to sx(9) locks,
which are sleepable. Drop the use of MTX_DUPOK/SX_DUPOK during lock
init, since we shouldn't be acquiring duplicate locks.
This does not appear to introduce any new issues, except where we
acquire Rx locks while holding the libafs AFS_GLOCK, which we probably
shouldn't be doing and is fixed in subsequent commits. Note that other
platforms also tend to use sleepable locks for afs_kmutex_t: for
example, on LINUX, we use struct mutex (which is sleepable).
Change-Id: I78ede8eb6ba8935d0082925c5475c42260eb7d59
Reviewed-on: https://gerrit.openafs.org/14183
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/afs/FBSD/osi_machdep.h | 1 +
src/rx/FBSD/rx_kmutex.h | 16 ++++++++--------
2 files changed, 9 insertions(+), 8 deletions(-)
--
OpenAFS Master Repository