From owner-p4-projects@FreeBSD.ORG Fri Feb 17 16:49:33 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B865A16A424; Fri, 17 Feb 2006 16:49:32 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 91B8D16A420 for ; Fri, 17 Feb 2006 16:49:32 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4460143D7D for ; Fri, 17 Feb 2006 16:49:32 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k1HGnWDY042662 for ; Fri, 17 Feb 2006 16:49:32 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k1HGnVZk042659 for perforce@freebsd.org; Fri, 17 Feb 2006 16:49:31 GMT (envelope-from jhb@freebsd.org) Date: Fri, 17 Feb 2006 16:49:31 GMT Message-Id: <200602171649.k1HGnVZk042659@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 91933 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2006 16:49:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=91933 Change 91933 by jhb@jhb_slimer on 2006/02/17 16:49:17 - Note the S_EXIT stop event before setting P_WEXIT so processes that are watching us can notice the exit w/o getting EIO back. - Do set P_WEXIT before the next wakeup of any waiting processes. They will get EIO, but they weren't listening for exits, so this matches previous behavior. Note that we don't handle multiple listeners at all. (And have never done so it seems) - Move the STOPEVENT and friends up to where we set P_WEXIT to avoid one more set of proc lock / unlock. Affected files ... .. //depot/projects/smpng/sys/kern/kern_exit.c#111 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_exit.c#111 (text+ko) ==== @@ -173,8 +173,30 @@ */ } + /* + * Wakeup anyone in procfs' PIOCWAIT. They should have a hold + * on our vmspace, so we should block below until they have + * released their reference to us. Note that if they have + * requested S_EXIT stops we will block here until they ack + * via PIOCCONT. + */ + _STOPEVENT(p, S_EXIT, rv); + + /* + * Note that we are exiting and do another wakeup of anyone in + * PIOCWAIT in case they aren't listening for S_EXIT stops or + * decided to wait again after we told them we are exiting. + */ p->p_flag |= P_WEXIT; + wakeup(&p->p_stype); + /* + * Wait for any processes that have a hold on our vmspace to + * release their reference. + */ + while (p->p_lock > 0) + msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0); + PROC_LOCK(p->p_pptr); sigqueue_take(p->p_ksi); PROC_UNLOCK(p->p_pptr); @@ -196,25 +218,6 @@ mtx_unlock(&ppeers_lock); } - PROC_LOCK(p); - _STOPEVENT(p, S_EXIT, rv); - - /* - * Wakeup anyone in procfs' PIOCWAIT. They should have a hold - * on our vmspace, so we should block below until they have - * released their reference to us. - */ - wakeup(&p->p_stype); - - /* - * Wait for any processes that have a hold on our vmspace to - * release their reference. - */ - while (p->p_lock > 0) - msleep(&p->p_lock, &p->p_mtx, PWAIT, "exithold", 0); - - PROC_UNLOCK(p); - /* * Check if any loadable modules need anything done at process exit. * E.g. SYSV IPC stuff