svn commit: r279283 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Wed Feb 25 16:17:17 UTC 2015


Author: kib
Date: Wed Feb 25 16:17:16 2015
New Revision: 279283
URL: https://svnweb.freebsd.org/changeset/base/279283

Log:
  When failing to claim ownership of a umtx_pi, restore the umutex owner
  to its previous, unowned state.  This avoids compounding an existing
  problem of inconsistent ownership.
  
  Submitted by:	Eric van Gyzen <eric_van_gyzen at dell.com>
  Obtained from:	Dell Inc.
  PR:	198914
  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 Feb 25 16:12:56 2015	(r279282)
+++ head/sys/kern/kern_umtx.c	Wed Feb 25 16:17:16 2015	(r279283)
@@ -1741,6 +1741,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