svn commit: r288958 - in stable: 10/sys/kern 9/sys/kern

John Baldwin jhb at FreeBSD.org
Tue Oct 6 22:28:30 UTC 2015


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);
 	}
 


More information about the svn-src-stable-9 mailing list