svn commit: r334048 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Tue May 22 15:13:26 UTC 2018


Author: mjg
Date: Tue May 22 15:13:25 2018
New Revision: 334048
URL: https://svnweb.freebsd.org/changeset/base/334048

Log:
  sx: fixup a braino in r334024
  
  If a thread waiting on sx dropped Giant it would not be properly
  reacquired on exit from the routine, later resulting in panics
  indicating Giant is not held (when it should be).
  
  The bug was not present in the original patch sent to pho, I wittingly
  added it just prior to the commit and only smoke-tested it.
  
  Reported by:	pho

Modified:
  head/sys/kern/kern_sx.c

Modified: head/sys/kern/kern_sx.c
==============================================================================
--- head/sys/kern/kern_sx.c	Tue May 22 14:36:46 2018	(r334047)
+++ head/sys/kern/kern_sx.c	Tue May 22 15:13:25 2018	(r334048)
@@ -879,6 +879,7 @@ retry_sleepq:
 	if (in_critical)
 		critical_exit();
 #endif
+	GIANT_RESTORE();
 #if defined(KDTRACE_HOOKS) || defined(LOCK_PROFILING)
 	if (__predict_true(!doing_lockprof))
 		return (error);
@@ -898,7 +899,6 @@ out_lockstat:
 	if (!error)
 		LOCKSTAT_PROFILE_OBTAIN_RWLOCK_SUCCESS(sx__acquire, sx,
 		    contested, waittime, file, line, LOCKSTAT_WRITER);
-	GIANT_RESTORE();
 	return (error);
 }
 


More information about the svn-src-all mailing list