Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Feb 2015 16:17:17 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r279283 - head/sys/kern
Message-ID:  <201502251617.t1PGHHXZ087098@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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;
 			}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502251617.t1PGHHXZ087098>