Date: Thu, 17 May 2018 19:41:58 +0000 (UTC) From: Matt Macy <mmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333758 - head/sys/kern Message-ID: <201805171941.w4HJfwFC027152@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mmacy Date: Thu May 17 19:41:58 2018 New Revision: 333758 URL: https://svnweb.freebsd.org/changeset/base/333758 Log: epoch(9): fix potential deadlock Don't acquire a waiting thread's lock while holding our own Approved by: sbruno Modified: head/sys/kern/subr_epoch.c Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Thu May 17 19:30:57 2018 (r333757) +++ head/sys/kern/subr_epoch.c Thu May 17 19:41:58 2018 (r333758) @@ -407,9 +407,13 @@ epoch_block_handler(struct ck_epoch *global __unused, * restore on exit from epoch_wait(). */ if (!TD_IS_INHIBITED(tdwait) && tdwait->td_priority > td->td_priority) { + critical_enter(); + thread_unlock(td); thread_lock(tdwait); sched_prio(tdwait, td->td_priority); thread_unlock(tdwait); + thread_lock(td); + critical_exit(); } if (TD_IS_INHIBITED(tdwait) && TD_ON_LOCK(tdwait) && ((ts = tdwait->td_blocked) != NULL)) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805171941.w4HJfwFC027152>