Module Name: src Committed By: dyoung Date: Mon Jan 31 23:00:34 UTC 2011
Modified Files: src/sys/kern: subr_autoconf.c Log Message: If there are readers or writers in the alldevs list, don't remove a device_t out from under them, but tag it for deletion, later. To generate a diff of this commit: cvs rdiff -u -r1.210 -r1.211 src/sys/kern/subr_autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/subr_autoconf.c diff -u src/sys/kern/subr_autoconf.c:1.210 src/sys/kern/subr_autoconf.c:1.211 --- src/sys/kern/subr_autoconf.c:1.210 Fri Jan 14 10:18:21 2011 +++ src/sys/kern/subr_autoconf.c Mon Jan 31 23:00:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_autoconf.c,v 1.210 2011/01/14 10:18:21 martin Exp $ */ +/* $NetBSD: subr_autoconf.c,v 1.211 2011/01/31 23:00:34 dyoung Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.210 2011/01/14 10:18:21 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.211 2011/01/31 23:00:34 dyoung Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -1700,8 +1700,14 @@ config_alldevs_enter(&af); KASSERT(alldevs_nwrite != 0); --alldevs_nwrite; - if (rv == 0 && dev->dv_del_gen == 0) - config_devunlink(dev, &af.af_garbage); + if (rv == 0 && dev->dv_del_gen == 0) { + if (alldevs_nwrite == 0 && alldevs_nread == 0) + config_devunlink(dev, &af.af_garbage); + else { + dev->dv_del_gen = alldevs_gen; + alldevs_garbage = true; + } + } config_alldevs_exit(&af); return rv;