From owner-freebsd-drivers@freebsd.org Thu Sep 3 09:47:33 2015 Return-Path: Delivered-To: freebsd-drivers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F8459C9EB1 for ; Thu, 3 Sep 2015 09:47:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1306F1E94; Thu, 3 Sep 2015 09:47:32 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t839lSFR052969 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 3 Sep 2015 12:47:28 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t839lSFR052969 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t839lRpA052968; Thu, 3 Sep 2015 12:47:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 3 Sep 2015 12:47:27 +0300 From: Konstantin Belousov To: John Baldwin Cc: freebsd-drivers@freebsd.org, Leonardo Fogel Subject: Re: Race conditions Message-ID: <20150903094727.GD2072@kib.kiev.ua> References: <1439923294.98963.YahooMailBasic@web120801.mail.ne1.yahoo.com> <17365161.8JflB5H0LB@ralph.baldwin.cx> <20150902135922.GZ2072@kib.kiev.ua> <1619676.EuPFulsFRT@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1619676.EuPFulsFRT@ralph.baldwin.cx> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Sep 2015 09:47:33 -0000 On Wed, Sep 02, 2015 at 10:59:12AM -0700, John Baldwin wrote: > If we allow a cdevsw to override how devname works, then that would probably > be sufficient on its own. I don't think you would need to change the > /dev/tapX devices at all. The cdevpriv for /dev/tap desciptors would have a > reference to the /dev/tapX device it is using and return that device's name > in the devname override. You mean, the consumers of tap use fdevname(3), not devname(3) ? Since for devname(), there is no access to cdevpriv. > > Another option that I had started to play with previously is to let devices > auto-created by /dev/tap set an internal 'destroy-on-close' flag. That > seems a bit more heavyweight, but it might also be simpler to implement? Could you, please, clarify, how this would help to handle the race at open ?