]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix the turnstile_lock() KPI.
authormarkj <markj@FreeBSD.org>
Wed, 24 Jul 2019 23:04:59 +0000 (23:04 +0000)
committermarkj <markj@FreeBSD.org>
Wed, 24 Jul 2019 23:04:59 +0000 (23:04 +0000)
commita05393f041d9d23e7a8967e23900a51d69f5732c
tree78f60d11b1c225ff8e595a6ad5d83f7e8dc65216
parenta56d11b0bf25d5c9061a87483b2f182ca365e58b
Fix the turnstile_lock() KPI.

turnstile_{lock,unlock}() were added for use in epoch.  turnstile_lock()
returned NULL to indicate that the calling thread had lost a race and
the turnstile was no longer associated with the given lock, or the lock
owner.  However, reader-writer locks may not have a designated owner,
in which case turnstile_lock() would return NULL and
epoch_block_handler_preempt() would leak spinlocks as a result.

Apply a minimal fix: return the lock owner as a separate return value.

Reviewed by: kib
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21048
sys/kern/subr_epoch.c
sys/kern/subr_turnstile.c
sys/sys/turnstile.h