Date: Tue, 3 Jul 2007 21:43:08 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Nate Lawson <nate@root.org> 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 Message-ID: <20070703184308.GL2200@deviant.kiev.zoral.com.ua> In-Reply-To: <468A9469.4060903@root.org> References: <20070703174242.49CC416A533@hub.freebsd.org> <468A9469.4060903@root.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Tue, Jul 03, 2007 at 11:24:41AM -0700, Nate Lawson wrote: > 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. 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@. [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQFGipi6C3+MBN1Mb4gRArfnAJ46SFZ0ab4n4LgM8FBpIXVaSc2CJQCg87r7 6h4b4MRk5sSfF0xSZKRI6xs= =/RDH -----END PGP SIGNATURE-----help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070703184308.GL2200>
