Date: Sat, 9 Jan 2016 18:24:53 +0000 (UTC) From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293607 - stable/10/sys/compat/linux Message-ID: <201601091824.u09IOrRp078402@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dchagin Date: Sat Jan 9 18:24:53 2016 New Revision: 293607 URL: https://svnweb.freebsd.org/changeset/base/293607 Log: MFC r287395 (by trasz): Fixes a panic triggered by threaded Linux applications when running with RACCT/RCTL enabled. Modified: stable/10/sys/compat/linux/linux_fork.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_fork.c ============================================================================== --- stable/10/sys/compat/linux/linux_fork.c Sat Jan 9 18:23:34 2016 (r293606) +++ stable/10/sys/compat/linux/linux_fork.c Sat Jan 9 18:24:53 2016 (r293607) @@ -286,10 +286,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); @@ -370,6 +380,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?201601091824.u09IOrRp078402>