From owner-cvs-src@FreeBSD.ORG Tue Jul 3 18:24:51 2007 Return-Path: X-Original-To: cvs-src@freebsd.org Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 46C8616A469 for ; Tue, 3 Jul 2007 18:24:51 +0000 (UTC) (envelope-from nate@root.org) Received: from root.org (root.org [67.118.192.226]) by mx1.freebsd.org (Postfix) with ESMTP id 1722813C46E for ; Tue, 3 Jul 2007 18:24:51 +0000 (UTC) (envelope-from nate@root.org) Received: (qmail 79140 invoked from network); 3 Jul 2007 18:24:51 -0000 Received: from ppp-71-139-42-13.dsl.snfc21.pacbell.net (HELO ?10.0.5.18?) (nate-mail@71.139.42.13) by root.org with ESMTPA; 3 Jul 2007 18:24:51 -0000 Message-ID: <468A9469.4060903@root.org> Date: Tue, 03 Jul 2007 11:24:41 -0700 From: Nate Lawson User-Agent: Thunderbird 2.0.0.4 (X11/20070617) MIME-Version: 1.0 To: Konstantin Belousov References: <20070703174242.49CC416A533@hub.freebsd.org> In-Reply-To: <20070703174242.49CC416A533@hub.freebsd.org> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/fs/devfs devfs_int.h devfs_vnops.c src/sys/kern kern_conf.c src/sys/sys conf.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2007 18:24:51 -0000 Konstantin Belousov wrote: > kib 2007-07-03 17:42:37 UTC > > FreeBSD src repository > > Modified files: > sys/fs/devfs devfs_int.h devfs_vnops.c > sys/kern kern_conf.c > sys/sys conf.h > Log: > Since rev. 1.199 of sys/kern/kern_conf.c, the thread that calls > destroy_dev() from d_close() cdev method would self-deadlock. > devfs_close() bump device thread reference counter, and destroy_dev() > sleeps, waiting for si_threadcount to reach zero for cdev without > d_purge method. > > destroy_dev_sched() could be used instead from d_close(), to > schedule execution of destroy_dev() in another context. The > destroy_dev_sched_drain() function can be used to drain the scheduled > calls to destroy_dev_sched(). Similarly, drain_dev_clone_events() drains > the events clone to make sure no lingering devices are left after > dev_clone event handler deregistered. > > make_dev_credf(MAKEDEV_REF) function should be used from dev_clone > event handlers instead of make_dev()/make_dev_cred() to ensure that created > device has reference counter bumped before cdev mutex is dropped inside > make_dev(). > > Reviewed by: tegge (early versions), njl (programming interface) > Debugging help and testing by: Peter Holm > Approved by: re (kensmith) > > Revision Changes Path > 1.4 +6 -0 src/sys/fs/devfs/devfs_int.h > 1.148 +13 -0 src/sys/fs/devfs/devfs_vnops.c > 1.204 +147 -18 src/sys/kern/kern_conf.c > 1.233 +10 -0 src/sys/sys/conf.h Thanks for all your work on this. Now to review all callers of destroy_dev() to see if they should use the simpler interface. -- Nate