From owner-svn-src-head@FreeBSD.ORG Thu Mar 27 18:46:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA9A279; Thu, 27 Mar 2014 18:46:57 +0000 (UTC) Received: from mail-we0-x235.google.com (mail-we0-x235.google.com [IPv6:2a00:1450:400c:c03::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 62F7D635; Thu, 27 Mar 2014 18:46:56 +0000 (UTC) Received: by mail-we0-f181.google.com with SMTP id q58so1983805wes.26 for ; Thu, 27 Mar 2014 11:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=iZ3RedeEzUsSAazlSJnzG5Aivi5TXo+WQWqFv1zqx5c=; b=iV1xtgWT3IvydspzgDEjgYzJZffMQgEfOrlUU2SXLqt/Yuw5viMgei7zHB8jsFXgt7 sQ0Jx+UAXxUQFYlmT0Xq+39SRLJYyfIbvnNGDBJR8Tsh+V3QynsJDl8kqrPZIIFVwZGq onlzELlDAlYiUU19pylIxrnd8nAylmBmyN7ZwlQ2u0Fo9WO312iPVjOrVSec6ItlAauR QtKL6jv0KfUSzRQj3zxMJ7n8mcTLPj84b3z3b18A4HArUJv8O4YRrL4qhtD3xS+YnQYN NrDafJ4IqBb+tS5SHUMXtpgwVRAVMzBhZvZgdpwRpQ65gJ1f9+J9tQTVyugxxWsJOYCc JzJA== X-Received: by 10.180.12.233 with SMTP id b9mr41568464wic.8.1395946014632; Thu, 27 Mar 2014 11:46:54 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id h19sm9684716wiw.17.2014.03.27.11.46.52 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 27 Mar 2014 11:46:53 -0700 (PDT) Date: Thu, 27 Mar 2014 19:46:50 +0100 From: Mateusz Guzik To: Warner Losh Subject: Re: svn commit: r263755 - head/sys/kern Message-ID: <20140327184650.GC4730@dft-labs.eu> References: <201403252330.s2PNUaei052956@svn.freebsd.org> <5333D70D.7050306@freebsd.org> <20140327083730.GA22942@dft-labs.eu> <54C6CC48-3B3B-412C-8C74-1A0A32534CC4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54C6CC48-3B3B-412C-8C74-1A0A32534CC4@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, David Xu , Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Mar 2014 18:46:57 -0000 On Thu, Mar 27, 2014 at 11:08:34AM -0600, Warner Losh wrote: > > On Mar 27, 2014, at 2:37 AM, Mateusz Guzik wrote: > > > On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote: > >> I think the async process pointer can be cleared when a process exits > >> by registering an event handler. please see attached patch. > >> > > > > Sure, but I'm not very fond of this solution. > > > > This is a rather obscure bug you wont hit unless you explicitly try, > > and even then you need root privs by default. > > > > As such writing a callback function which will be executed for all exiting > > processes seems unjustified for me. > > > > Ideally we would get some mechanism which would allow to register > > callbacks for events related to given entity. Then it could be used to > > provide a "call this function when process p exits", amongst other things. > > I’m wondering why the FD isn’t getting closed and the close() routine being called > which should clear this pointer. Since we can only ever have one opener, we > know the close will always be called. > > What am I missing? Seems like an invented non-issue. > This happens if you set yourself as async_proc and fork (so the child has the fd as well) or pass the fd to some other process before exiting. As was noted, this is not the case with devd so no rush. -- Mateusz Guzik