From owner-svn-src-all@FreeBSD.ORG Thu Apr 5 10:33:39 2012 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 D5B65106566B; Thu, 5 Apr 2012 10:33:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C05348FC16; Thu, 5 Apr 2012 10:33:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q35AXdkh054835; Thu, 5 Apr 2012 10:33:39 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q35AXdxb054833; Thu, 5 Apr 2012 10:33:39 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201204051033.q35AXdxb054833@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 5 Apr 2012 10:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233920 - stable/9/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: Thu, 05 Apr 2012 10:33:39 -0000 Author: kib Date: Thu Apr 5 10:33:39 2012 New Revision: 233920 URL: http://svn.freebsd.org/changeset/base/233920 Log: MFC r233809: When process exists, not only the children shall be reparented to init, but also the orphans shall be removed from the orphan list, because the list header is destroyed. Modified: stable/9/sys/kern/kern_exit.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_exit.c ============================================================================== --- stable/9/sys/kern/kern_exit.c Thu Apr 5 10:30:54 2012 (r233919) +++ stable/9/sys/kern/kern_exit.c Thu Apr 5 10:33:39 2012 (r233920) @@ -430,6 +430,13 @@ exit1(struct thread *td, int rv) if (q->p_flag & P_TRACED) { struct thread *temp; + /* + * Since q was found on our children list, the + * proc_reparent() call moved q to the orphan + * list due to present P_TRACED flag. Clear + * orphan link for q now while q is locked. + */ + clear_orphan(q); q->p_flag &= ~(P_TRACED | P_STOPPED_TRACE); FOREACH_THREAD_IN_PROC(q, temp) temp->td_dbgflags &= ~TDB_SUSPEND; @@ -438,6 +445,15 @@ exit1(struct thread *td, int rv) PROC_UNLOCK(q); } + /* + * Also get rid of our orphans. + */ + while ((q = LIST_FIRST(&p->p_orphans)) != NULL) { + PROC_LOCK(q); + clear_orphan(q); + PROC_UNLOCK(q); + } + /* Save exit status. */ PROC_LOCK(p); p->p_xthread = td;