Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jan 2020 08:55:27 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r356906 - in stable/12/sys: compat/linuxkpi/common/src kern
Message-ID:  <202001200855.00K8tRIV074405@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Jan 20 08:55:27 2020
New Revision: 356906
URL: https://svnweb.freebsd.org/changeset/base/356906

Log:
  MFC r356682:
  Code must not unlock a mutex while owning the thread lock.

Modified:
  stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c
  stable/12/sys/kern/subr_epoch.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c	Mon Jan 20 08:28:54 2020	(r356905)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_rcu.c	Mon Jan 20 08:55:27 2020	(r356906)
@@ -297,14 +297,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: stable/12/sys/kern/subr_epoch.c
==============================================================================
--- stable/12/sys/kern/subr_epoch.c	Mon Jan 20 08:28:54 2020	(r356905)
+++ stable/12/sys/kern/subr_epoch.c	Mon Jan 20 08:55:27 2020	(r356906)
@@ -499,8 +499,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?202001200855.00K8tRIV074405>