svn commit: r279585 - stable/10/sys/kern

Konstantin Belousov kib at FreeBSD.org
Wed Mar 4 09:31:11 UTC 2015


Author: kib
Date: Wed Mar  4 09:31:10 2015
New Revision: 279585
URL: https://svnweb.freebsd.org/changeset/base/279585

Log:
  MFC r279283:
  When failing to claim ownership of a umtx_pi, restore the umutex owner
  to its previous, unowned state.

Modified:
  stable/10/sys/kern/kern_umtx.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_umtx.c
==============================================================================
--- stable/10/sys/kern/kern_umtx.c	Wed Mar  4 09:30:03 2015	(r279584)
+++ stable/10/sys/kern/kern_umtx.c	Wed Mar  4 09:31:10 2015	(r279585)
@@ -2106,6 +2106,17 @@ do_lock_pi(struct thread *td, struct umu
 				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;
 			}
 


More information about the svn-src-all mailing list