Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jan 2020 14:30:20 +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: r356682 - in head/sys: compat/linuxkpi/common/src kern
Message-ID:  <202001131430.00DEUK7x064219@repo.freebsd.org>

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



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