Author: kib
Date: Mon Jul 15 19:18:25 2019
New Revision: 350005
URL: https://svnweb.freebsd.org/changeset/base/350005

Log:
  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

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==============================================================================
--- head/sys/kern/kern_umtx.c   Mon Jul 15 17:13:32 2019        (r350004)
+++ head/sys/kern/kern_umtx.c   Mon Jul 15 19:18:25 2019        (r350005)
@@ -3316,14 +3316,13 @@ do_sem2_wait(struct thread *td, struct _usem2 *sem, st
 
        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);
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to