Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Oct 2015 22:28:28 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r288958 - in stable: 10/sys/kern 9/sys/kern
Message-ID:  <201510062228.t96MSS9a060426@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Oct  6 22:28:28 2015
New Revision: 288958
URL: https://svnweb.freebsd.org/changeset/base/288958

Log:
  MFC 287833:
  Threads holding a read lock of a sleepable rm lock are not permitted
  to sleep.  The rmlock implementation enforces this by disabling
  sleeping when a read lock is acquired. To simplify the implementation,
  sleeping is disabled for most of the duration of rm_rlock.  However,
  it doesn't need to be disabled until the lock is acquired.  If a
  sleepable rm lock is contested, then rm_rlock may need to acquire the
  backing sx lock.  This tripped the overly-broad assertion.  Fix by
  relaxing the assertion around the call to sx_xlock().

Modified:
  stable/9/sys/kern/kern_rmlock.c
Directory Properties:
  stable/9/sys/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/kern/kern_rmlock.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/sys/kern/kern_rmlock.c
==============================================================================
--- stable/9/sys/kern/kern_rmlock.c	Tue Oct  6 21:58:38 2015	(r288957)
+++ stable/9/sys/kern/kern_rmlock.c	Tue Oct  6 22:28:28 2015	(r288958)
@@ -375,9 +375,11 @@ _rm_rlock_hard(struct rmlock *rm, struct
 				return (0);
 		}
 	} else {
-		if (rm->lock_object.lo_flags & LO_SLEEPABLE)
+		if (rm->lock_object.lo_flags & LO_SLEEPABLE) {
+			THREAD_SLEEPING_OK();
 			sx_xlock(&rm->rm_lock_sx);
-		else
+			THREAD_NO_SLEEPING();
+		} else
 			mtx_lock(&rm->rm_lock_mtx);
 	}
 



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