diff options
author | Alexander Motin <mav@FreeBSD.org> | 2022-03-22 02:43:39 +0300 |
---|---|---|
committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2022-11-12 14:59:27 +0300 |
commit | 62e1bb424584ca6a46e6224801d25b9fc6ca5ef9 (patch) | |
tree | 03a268eb3203d3b01c91492bd5421de7d0ea2d83 | |
parent | e21c77f80c3b1cf2bd0a9f874e15e7a8e49f0dba (diff) |
Fix umtxq_sleep() regression caused by 56070dd2e4d.
umtxq_requeue() moves the queue to a different hash chain and different
lock, so we can't rely on msleep_sbt() reacquiring the same old lock.
We have to use PDROP and update the queue chain and so lock pointer.
PR: 262587
(cherry picked from commit fd6ca665d206b74970e7c01d06ae06fed71500fc)
-rw-r--r-- | sys/kern/kern_umtx.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 398ee23c5148..8a0b140c2794 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -808,8 +808,10 @@ umtxq_sleep(struct umtx_q *uq, const char *wmesg, if (error != 0) break; } - error = msleep_sbt(uq, &uc->uc_lock, PCATCH, wmesg, + error = msleep_sbt(uq, &uc->uc_lock, PCATCH | PDROP, wmesg, sbt, 0, flags); + uc = umtxq_getchain(&uq->uq_key); + mtx_lock(&uc->uc_lock); if (error == EINTR || error == ERESTART) break; if (error == EWOULDBLOCK && (flags & C_ABSOLUTE) != 0) { |