From owner-svn-src-all@FreeBSD.ORG Tue Jun 19 22:22:00 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 49D111065672; Tue, 19 Jun 2012 22:22:00 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 34ABE8FC0A; Tue, 19 Jun 2012 22:22:00 +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 q5JMM0S1000745; Tue, 19 Jun 2012 22:22:00 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5JMLxVj000743; Tue, 19 Jun 2012 22:22:00 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201206192222.q5JMLxVj000743@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 19 Jun 2012 22:21:59 +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: r237276 - 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: Tue, 19 Jun 2012 22:22:00 -0000 Author: pjd Date: Tue Jun 19 22:21:59 2012 New Revision: 237276 URL: http://svn.freebsd.org/changeset/base/237276 Log: The falloc() function obtains two references to newly created 'fp'. On success we have to drop one after procdesc_finit() and on failure we have to close allocated slot with fdclose(), which also drops one reference for us and drop the remaining reference with fdrop(). Without this change closing process descriptor didn't result in killing pdfork(2)ed child. Reviewed by: rwatson MFC after: 1 month Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Tue Jun 19 19:40:54 2012 (r237275) +++ head/sys/kern/kern_fork.c Tue Jun 19 22:21:59 2012 (r237276) @@ -921,8 +921,10 @@ fork1(struct thread *td, int flags, int */ *procp = newproc; #ifdef PROCDESC - if (flags & RFPROCDESC) + if (flags & RFPROCDESC) { procdesc_finit(newproc->p_procdesc, fp_procdesc); + fdrop(fp_procdesc, td); + } #endif racct_proc_fork_done(newproc); return (0); @@ -944,8 +946,10 @@ fail1: vmspace_free(vm2); uma_zfree(proc_zone, newproc); #ifdef PROCDESC - if (((flags & RFPROCDESC) != 0) && (fp_procdesc != NULL)) + if (((flags & RFPROCDESC) != 0) && (fp_procdesc != NULL)) { + fdclose(td->td_proc->p_fd, fp_procdesc, *procdescp, td); fdrop(fp_procdesc, td); + } #endif pause("fork", hz / 2); return (error);