svn commit: r356682 - in head/sys: compat/linuxkpi/common/src kern

Konstantin Belousov kib at FreeBSD.org
Mon Jan 13 14:30:20 UTC 2020


Author: kib
Date: Mon Jan 13 14:30:19 2020
New Revision: 356682
URL: https://svnweb.freebsd.org/changeset/base/356682

Log:
  Code must not unlock a mutex while owning the thread lock.
  
  Reviewed by:	hselasky, markj
  Sponsored by:	Mellanox Technologies
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D23150

Modified:
  head/sys/compat/linuxkpi/common/src/linux_rcu.c
  head/sys/kern/subr_epoch.c

Modified: head/sys/compat/linuxkpi/common/src/linux_rcu.c
==============================================================================
--- head/sys/compat/linuxkpi/common/src/linux_rcu.c	Mon Jan 13 11:33:03 2020	(r356681)
+++ head/sys/compat/linuxkpi/common/src/linux_rcu.c	Mon Jan 13 14:30:19 2020	(r356682)
@@ -298,14 +298,13 @@ linux_synchronize_rcu(void)
 	    "linux_synchronize_rcu() can sleep");
 
 	td = curthread;
+	DROP_GIANT();
 
 	/*
 	 * Synchronizing RCU might change the CPU core this function
 	 * is running on. Save current values:
 	 */
 	thread_lock(td);
-
-	DROP_GIANT();
 
 	old_cpu = PCPU_GET(cpuid);
 	old_pinned = td->td_pinned;

Modified: head/sys/kern/subr_epoch.c
==============================================================================
--- head/sys/kern/subr_epoch.c	Mon Jan 13 11:33:03 2020	(r356681)
+++ head/sys/kern/subr_epoch.c	Mon Jan 13 14:30:19 2020	(r356682)
@@ -610,8 +610,8 @@ epoch_wait_preempt(epoch_t epoch)
 	KASSERT(!in_epoch(epoch), ("epoch_wait_preempt() called in the middle "
 	    "of an epoch section of the same epoch"));
 #endif
-	thread_lock(td);
 	DROP_GIANT();
+	thread_lock(td);
 
 	old_cpu = PCPU_GET(cpuid);
 	old_pinned = td->td_pinned;


More information about the svn-src-head mailing list