From owner-cvs-all@FreeBSD.ORG Sun Oct 19 13:41:08 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D532616A4B3; Sun, 19 Oct 2003 13:41:08 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 16EC243FCB; Sun, 19 Oct 2003 13:41:08 -0700 (PDT) (envelope-from dwmalone@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h9JKf7XJ075633; Sun, 19 Oct 2003 13:41:07 -0700 (PDT) (envelope-from dwmalone@repoman.freebsd.org) Received: (from dwmalone@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h9JKf712075632; Sun, 19 Oct 2003 13:41:07 -0700 (PDT) (envelope-from dwmalone) Message-Id: <200310192041.h9JKf712075632@repoman.freebsd.org> From: David Malone Date: Sun, 19 Oct 2003 13:41:07 -0700 (PDT) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/sys/dev/streams streams.c src/sys/kern kern_descrip.c kern_event.c sys_pipe.c uipc_syscalls.c vfs_syscalls.c src/sys/opencrypto cryptodev.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2003 20:41:09 -0000 dwmalone 2003/10/19 13:41:07 PDT FreeBSD src repository Modified files: sys/dev/streams streams.c sys/kern kern_descrip.c kern_event.c sys_pipe.c uipc_syscalls.c vfs_syscalls.c sys/opencrypto cryptodev.c Log: falloc allocates a file structure and adds it to the file descriptor table, acquiring the necessary locks as it works. It usually returns two references to the new descriptor: one in the descriptor table and one via a pointer argument. As falloc releases the FILEDESC lock before returning, there is a potential for a process to close the reference in the file descriptor table before falloc's caller gets to use the file. I don't think this can happen in practice at the moment, because Giant indirectly protects closes. To stop the file being completly closed in this situation, this change makes falloc set the refcount to two when both references are returned. This makes life easier for several of falloc's callers, because the first thing they previously did was grab an extra reference on the file. Reviewed by: iedowse Idea run past: jhb Revision Changes Path 1.43 +12 -3 src/sys/dev/streams/streams.c 1.215 +22 -2 src/sys/kern/kern_descrip.c 1.61 +2 -0 src/sys/kern/kern_event.c 1.153 +3 -1 src/sys/kern/sys_pipe.c 1.157 +3 -4 src/sys/kern/uipc_syscalls.c 1.332 +2 -10 src/sys/kern/vfs_syscalls.c 1.16 +1 -1 src/sys/opencrypto/cryptodev.c