svn commit: r350478 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Wed Jul 31 19:16:49 UTC 2019
Author: kib
Date: Wed Jul 31 19:16:49 2019
New Revision: 350478
URL: https://svnweb.freebsd.org/changeset/base/350478
Log:
Fix handling of transient casueword(9) failures in do_sem_wait().
In particular, restart should be only done when the failure is
transient. For this, recheck the count1 value after the operation.
Note that do_sem_wait() is older usem interface.
Reported and tested by: bdrewery
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/sys/kern/kern_umtx.c
Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c Wed Jul 31 18:44:20 2019 (r350477)
+++ head/sys/kern/kern_umtx.c Wed Jul 31 19:16:49 2019 (r350478)
@@ -3229,7 +3229,8 @@ again:
rv = casueword32(&sem->_has_waiters, 0, &count1, 1);
if (rv == 0)
rv1 = fueword32(&sem->_count, &count);
- if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) || rv == 1) {
+ if (rv == -1 || (rv == 0 && (rv1 == -1 || count != 0)) ||
+ (rv == 1 && count1 == 0)) {
umtxq_lock(&uq->uq_key);
umtxq_unbusy(&uq->uq_key);
umtxq_remove(uq);
More information about the svn-src-all
mailing list