From owner-svn-src-all@FreeBSD.ORG Fri Oct 24 01:03:32 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 062921065699; Fri, 24 Oct 2008 01:03:32 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7F038FC0C; Fri, 24 Oct 2008 01:03:31 +0000 (UTC) (envelope-from davidxu@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 m9O13VCE071076; Fri, 24 Oct 2008 01:03:31 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9O13V7f071075; Fri, 24 Oct 2008 01:03:31 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <200810240103.m9O13V7f071075@svn.freebsd.org> From: David Xu Date: Fri, 24 Oct 2008 01:03:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184216 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2008 01:03:32 -0000 Author: davidxu Date: Fri Oct 24 01:03:31 2008 New Revision: 184216 URL: http://svn.freebsd.org/changeset/base/184216 Log: partly revert revision 184199, because TDF_NEEDSIGCHK is persitent when thread is in kernel mode, it can cause dead loop, now unlock process lock after acquired sleep queue lock and thread lock to avoid the problem. This means TDF_NEEDSIGCHK and TDF_NEEDSUSPCHK must be set with process lock and thread lock being hold at same time. Modified: head/sys/kern/subr_sleepqueue.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Thu Oct 23 21:50:16 2008 (r184215) +++ head/sys/kern/subr_sleepqueue.c Fri Oct 24 01:03:31 2008 (r184216) @@ -396,7 +396,6 @@ sleepq_catch_signals(void *wchan, int pr return (0); } -catch_sig: thread_unlock(td); mtx_unlock_spin(&sc->sc_lock); CTR3(KTR_PROC, "sleepq catching signals: thread %p (pid %ld, %s)", @@ -416,19 +415,15 @@ catch_sig: ret = ERESTART; mtx_unlock(&ps->ps_mtx); } - PROC_UNLOCK(p); mtx_lock_spin(&sc->sc_lock); thread_lock(td); - if (ret != 0) - goto out; - if ((td->td_flags & (TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK)) != 0) - goto catch_sig; - - sleepq_switch(wchan, pri); - return (0); + PROC_UNLOCK(p); + if (ret == 0) { + sleepq_switch(wchan, pri); + return (0); + } -out: /* * There were pending signals and this thread is still * on the sleep queue, remove it from the sleep queue.