From owner-svn-src-stable@FreeBSD.ORG Wed Mar 11 00:58:23 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E1E71065672; Wed, 11 Mar 2009 00:58:23 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1B2488FC19; Wed, 11 Mar 2009 00:58:23 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2B0wMWR078637; Wed, 11 Mar 2009 00:58:22 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2B0wMNM078636; Wed, 11 Mar 2009 00:58:22 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200903110058.n2B0wMNM078636@svn.freebsd.org> From: Andrew Thompson Date: Wed, 11 Mar 2009 00:58:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189658 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2009 00:58:23 -0000 Author: thompsa Date: Wed Mar 11 00:58:22 2009 New Revision: 189658 URL: http://svn.freebsd.org/changeset/base/189658 Log: MFC r188548 Check the exit flag at the start of the taskqueue loop rather than the end. It is possible to tear down the taskqueue before the thread has run and the taskqueue loop would sleep forever. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/kern/subr_taskqueue.c Modified: stable/7/sys/kern/subr_taskqueue.c ============================================================================== --- stable/7/sys/kern/subr_taskqueue.c Wed Mar 11 00:29:22 2009 (r189657) +++ stable/7/sys/kern/subr_taskqueue.c Wed Mar 11 00:58:22 2009 (r189658) @@ -397,10 +397,10 @@ taskqueue_thread_loop(void *arg) tqp = arg; tq = *tqp; TQ_LOCK(tq); - do { + while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) { taskqueue_run(tq); TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0); - } while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0); + } /* rendezvous with thread that asked us to terminate */ tq->tq_pcount--;