From owner-freebsd-current@FreeBSD.ORG Mon Jun 28 08:40:42 2010 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31EA0106564A; Mon, 28 Jun 2010 08:40:42 +0000 (UTC) (envelope-from des@des.no) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id E28AB8FC13; Mon, 28 Jun 2010 08:40:41 +0000 (UTC) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id C6A141FFC35; Mon, 28 Jun 2010 08:40:40 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 92AFE84525; Mon, 28 Jun 2010 10:38:29 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: "M. Warner Losh" References: <20100627.160845.256787458594170652.imp@bsdimp.com> <20100627.201716.1108826596298620201.imp@bsdimp.com> <86iq537egy.fsf@ds4.des.no> Date: Mon, 28 Jun 2010 10:38:29 +0200 In-Reply-To: <86iq537egy.fsf@ds4.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8rg?= =?utf-8?Q?rav=22's?= message of "Mon, 28 Jun 2010 10:23:25 +0200") Message-ID: <86eifr7dru.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: yanefbsd@gmail.com, freebsd-current@FreeBSD.org, pjd@FreeBSD.org, hselasky@c2i.net Subject: Re: Patch for rc.d/devd on FreeBSD 9-current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jun 2010 08:40:42 -0000 Dag-Erling Sm=C3=B8rgrav writes: > "M. Warner Losh" writes: >> Maybe the real problem is that devd locks the file, then dies. The >> file remains locked, so the flopen is failing with EWOULDBLOCK. > > The lock is released when the process that holds it terminates. > >> But I suspect the real real problem is the implicit assumption that >> flock will release the lock when a process terminates... That isn't >> the case in BSD > Yes it is. Additional details: - Under POSIX semantics (fcntl(2) locks), the lock is released when *any* file descriptor the process holds for that file is closed. This is handled in fdfree(). - Under flock semantics (flock(2) locks), the lock is released when *all* file descriptors the process holds for that file is closed. This is handled in vn_closefile(). - In both cases, all locks a process holds are released when the process terminates. Gotta love the following excerpt from VOP_OPEN(9), btw: The VOP_OPEN() entry point is called before a file is accessed by a process and the VOP_CLOSE() entry point is called after a file is fin=E2= =80=90 ished with by the process. :) DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no