Date: Tue, 31 Mar 2020 02:25:54 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359477 - head/sys/netinet6 Message-ID: <202003310225.02V2PsAC002633@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Tue Mar 31 02:25:53 2020 New Revision: 359477 URL: https://svnweb.freebsd.org/changeset/base/359477 Log: Use a dedicated taskqueue thread for in6m_release_task(). Interfaces may be detached from a taskqueue_thread task, for example by prison_complete(), so after r359438, when draining the queue we may end up deadlocking. Reported by: Jenkins via lwhsu MFC with: r359438 Modified: head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Tue Mar 31 01:18:00 2020 (r359476) +++ head/sys/netinet6/in6_mcast.c Tue Mar 31 02:25:53 2020 (r359477) @@ -510,14 +510,19 @@ in6m_release(struct in6_multi *inm) } } -static struct task free_task; +/* + * Interface detach can happen in a taskqueue thread context, so we must use a + * dedicated thread to avoid deadlocks when draining in6m_release tasks. + */ +TASKQUEUE_DEFINE_THREAD(in6m_free); +static struct task in6m_free_task; static struct in6_multi_head in6m_free_list = SLIST_HEAD_INITIALIZER(); static void in6m_release_task(void *arg __unused, int pending __unused); static void in6m_init(void) { - TASK_INIT(&free_task, 0, in6m_release_task, NULL); + TASK_INIT(&in6m_free_task, 0, in6m_release_task, NULL); } SYSINIT(in6m_init, SI_SUB_TASKQ, SI_ORDER_ANY, in6m_init, NULL); @@ -529,13 +534,13 @@ in6m_release_list_deferred(struct in6_multi_head *inmh mtx_lock(&in6_multi_free_mtx); SLIST_CONCAT(&in6m_free_list, inmh, in6_multi, in6m_nrele); mtx_unlock(&in6_multi_free_mtx); - taskqueue_enqueue(taskqueue_thread, &free_task); + taskqueue_enqueue(taskqueue_in6m_free, &in6m_free_task); } void in6m_release_wait(void) { - taskqueue_drain_all(taskqueue_thread); + taskqueue_drain_all(taskqueue_in6m_free); } void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202003310225.02V2PsAC002633>