In do_sem2_wait(), balance umtx_key_get() with umtx_key_release() on retry.

Reported by:	ler
Bisected and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	12 days
This commit is contained in:
Konstantin Belousov 2019-07-15 19:18:25 +00:00
parent ca2cae0b4d
commit 9f7b7da5bf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=350005

View File

@ -3316,14 +3316,13 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, struct _umtx_time *timeout)
uq = td->td_umtxq;
flags = fuword32(&sem->_flags);
error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key);
if (error != 0)
return (error);
if (timeout != NULL)
abs_timeout_init2(&timo, timeout);
again:
error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key);
if (error != 0)
return (error);
umtxq_lock(&uq->uq_key);
umtxq_busy(&uq->uq_key);
umtxq_insert(uq);