Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern If there are readers or writers in the alldevs list...



details:   https://anonhg.NetBSD.org/src/rev/7bc5dd639f4b
branches:  trunk
changeset: 761550:7bc5dd639f4b
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Mon Jan 31 23:00:34 2011 +0000

description:
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.

diffstat:

 sys/kern/subr_autoconf.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r d0b551de527f -r 7bc5dd639f4b sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Mon Jan 31 22:51:39 2011 +0000
+++ b/sys/kern/subr_autoconf.c  Mon Jan 31 23:00:34 2011 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index