From owner-cvs-all@FreeBSD.ORG Tue Jul 3 18:43:21 2007 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 99C7516A421; Tue, 3 Jul 2007 18:43:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from relay01.kiev.sovam.com (relay01.kiev.sovam.com [62.64.120.200]) by mx1.freebsd.org (Postfix) with ESMTP id 2991513C45A; Tue, 3 Jul 2007 18:43:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from [89.162.146.170] (helo=skuns.kiev.zoral.com.ua) by relay01.kiev.sovam.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.67) (envelope-from ) id 1I5nLK-000MJp-Ei; Tue, 03 Jul 2007 21:43:19 +0300 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by skuns.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l63Ih3MJ039937 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 3 Jul 2007 21:43:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1) with ESMTP id l63Ih8tI030270; Tue, 3 Jul 2007 21:43:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.1/8.14.1/Submit) id l63Ih8Ov030269; Tue, 3 Jul 2007 21:43:08 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 3 Jul 2007 21:43:08 +0300 From: Kostik Belousov To: Nate Lawson Message-ID: <20070703184308.GL2200@deviant.kiev.zoral.com.ua> References: <20070703174242.49CC416A533@hub.freebsd.org> <468A9469.4060903@root.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6CXocAQn8Xbegyxo" Content-Disposition: inline In-Reply-To: <468A9469.4060903@root.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.90.2, clamav-milter version 0.90.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on skuns.kiev.zoral.com.ua X-Scanner-Signature: 9f090f397804869cf00fade203417d62 X-DrWeb-checked: yes X-SpamTest-Envelope-From: kostikbel@gmail.com X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 1188 [July 03 2007] X-SpamTest-Info: helo_type=3 X-SpamTest-Method: none X-SpamTest-Rate: 0 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0255], KAS30/Release 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-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 03 Jul 2007 18:43:21 -0000 --6CXocAQn8Xbegyxo Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jul 03, 2007 at 11:24:41AM -0700, Nate Lawson wrote: > Konstantin Belousov wrote: > > kib 2007-07-03 17:42:37 UTC > >=20 > > FreeBSD src repository > >=20 > > Modified files: > > sys/fs/devfs devfs_int.h devfs_vnops.c=20 > > sys/kern kern_conf.c=20 > > sys/sys conf.h=20 > > 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. > > =20 > > 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() dra= ins > > the events clone to make sure no lingering devices are left after > > dev_clone event handler deregistered. > > =20 > > make_dev_credf(MAKEDEV_REF) function should be used from dev_clone > > event handlers instead of make_dev()/make_dev_cred() to ensure that c= reated > > device has reference counter bumped before cdev mutex is dropped insi= de > > make_dev(). > > =20 > > Reviewed by: tegge (early versions), njl (programming interface) > > Debugging help and testing by: Peter Holm > > Approved by: re (kensmith) > > =20 > > 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 >=20 > Thanks for all your work on this. Now to review all callers of > destroy_dev() to see if they should use the simpler interface. I committed the version of destroy_dev() that shall support autodetection of deadlock (hopefully, got it right second time). It is done in separate commit to ease the reversal. See my HEADS UP on current@. --6CXocAQn8Xbegyxo Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGipi6C3+MBN1Mb4gRArfnAJ46SFZ0ab4n4LgM8FBpIXVaSc2CJQCg87r7 6h4b4MRk5sSfF0xSZKRI6xs= =/RDH -----END PGP SIGNATURE----- --6CXocAQn8Xbegyxo--