svn commit: r287833 - head/sys/kern
John Baldwin
jhb at FreeBSD.org
Tue Sep 15 22:16:22 UTC 2015
Author: jhb
Date: Tue Sep 15 22:16:21 2015
New Revision: 287833
URL: https://svnweb.freebsd.org/changeset/base/287833
Log:
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().
Reported by: mjg
Reviewed by: kib, mjg
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D3324
Modified:
head/sys/kern/kern_rmlock.c
Modified: head/sys/kern/kern_rmlock.c
==============================================================================
--- head/sys/kern/kern_rmlock.c Tue Sep 15 21:16:45 2015 (r287832)
+++ head/sys/kern/kern_rmlock.c Tue Sep 15 22:16:21 2015 (r287833)
@@ -407,9 +407,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-all
mailing list