diff options
author | kib <kib@FreeBSD.org> | 2015-03-04 09:31:10 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-03-04 09:31:10 +0000 |
commit | efbc02bc53bbf64ede10aad57b8138eef1036593 (patch) | |
tree | 4ea1247ac26626b61001da8139c5f9b11507bc64 | |
parent | 17814a5b03ddffbc09f04c52fe17412399efcd2f (diff) | |
download | FreeBSD-src-efbc02bc53bbf64ede10aad57b8138eef1036593.zip FreeBSD-src-efbc02bc53bbf64ede10aad57b8138eef1036593.tar.gz |
MFC r279283:
When failing to claim ownership of a umtx_pi, restore the umutex owner
to its previous, unowned state.
-rw-r--r-- | sys/kern/kern_umtx.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index c5f90e0..108ac70 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -2106,6 +2106,17 @@ do_lock_pi(struct thread *td, struct umutex *m, uint32_t flags, error = umtx_pi_claim(pi, td); umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key); + if (error != 0) { + /* + * Since we're going to return an + * error, restore the m_owner to its + * previous, unowned state to avoid + * compounding the problem. + */ + (void)casuword32(&m->m_owner, + id | UMUTEX_CONTESTED, + UMUTEX_CONTESTED); + } break; } |