Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Turn a KASSERT into a panic. I don't want us to be...



details:   https://anonhg.NetBSD.org/src/rev/f9b9cffca37b
branches:  trunk
changeset: 747752:f9b9cffca37b
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Oct 01 07:42:45 2009 +0000

description:
Turn a KASSERT into a panic.  I don't want us to be randomly
overwriting memory on non-DIAGNOSTIC kernels if resource estimation
fails.

diffstat:

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

diffs (35 lines):

diff -r b86dc0494108 -r f9b9cffca37b sys/kern/vfs_wapbl.c
--- a/sys/kern/vfs_wapbl.c      Thu Oct 01 05:42:22 2009 +0000
+++ b/sys/kern/vfs_wapbl.c      Thu Oct 01 07:42:45 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_wapbl.c,v 1.26 2009/07/14 20:59:00 apb Exp $       */
+/*     $NetBSD: vfs_wapbl.c,v 1.27 2009/10/01 07:42:45 pooka Exp $     */
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.26 2009/07/14 20:59:00 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.27 2009/10/01 07:42:45 pooka Exp $");
 
 #include <sys/param.h>
 
@@ -1668,8 +1668,14 @@
        wapbl_jlock_assert(wl);
 
        /* XXX should eventually instead tie this into resource estimation */
-       /* XXX this KASSERT needs locking/mutex analysis */
-       KASSERT(wl->wl_dealloccnt < wl->wl_dealloclim);
+       /*
+        * XXX this panic needs locking/mutex analysis and the
+        * ability to cope with the failure.
+        */
+       /* XXX this XXX doesn't have enough XXX */
+       if (__predict_false(wl->wl_dealloccnt >= wl->wl_dealloclim))
+               panic("wapbl_register_deallocation: out of resources");
+
        wl->wl_deallocblks[wl->wl_dealloccnt] = blk;
        wl->wl_dealloclens[wl->wl_dealloccnt] = len;
        wl->wl_dealloccnt++;



Home | Main Index | Thread Index | Old Index