Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 2 Sep 2015 14:04:14 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r287395 - head/sys/compat/linux
Message-ID:  <201509021404.t82E4E46037569@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Wed Sep  2 14:04:13 2015
New Revision: 287395
URL: https://svnweb.freebsd.org/changeset/base/287395

Log:
  Fixes a panic triggered by threaded Linux applications when running
  with RACCT/RCTL enabled.
  
  Reviewed by:	ngie@, ed@
  Tested by:	Larry Rosenman <ler@lerctr.org>
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D3470

Modified:
  head/sys/compat/linux/linux_fork.c

Modified: head/sys/compat/linux/linux_fork.c
==============================================================================
--- head/sys/compat/linux/linux_fork.c	Wed Sep  2 12:46:42 2015	(r287394)
+++ head/sys/compat/linux/linux_fork.c	Wed Sep  2 14:04:13 2015	(r287395)
@@ -285,10 +285,20 @@ linux_clone_thread(struct thread *td, st
 
 	p = td->td_proc;
 
+#ifdef RACCT
+	if (racct_enable) {
+		PROC_LOCK(p);
+		error = racct_add(p, RACCT_NTHR, 1);
+		PROC_UNLOCK(p);
+		if (error != 0)
+			return (EPROCLIM);
+	}
+#endif
+
 	/* Initialize our td */
 	error = kern_thr_alloc(p, 0, &newtd);
 	if (error)
-		return (error);
+		goto fail;
 														
 	cpu_set_upcall(newtd, td);
 
@@ -369,6 +379,16 @@ linux_clone_thread(struct thread *td, st
 	td->td_retval[0] = newtd->td_tid;
 
 	return (0);
+
+fail:
+#ifdef RACCT
+	if (racct_enable) {
+		PROC_LOCK(p);
+		racct_sub(p, RACCT_NTHR, 1);
+		PROC_UNLOCK(p);
+	}
+#endif
+	return (error);
 }
 
 int



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