Source-Changes-HG archive

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

[src/chs-ubc2]: src/sys/kern expand splhigh() to be around the entire body of...



details:   https://anonhg.NetBSD.org/src/rev/eadd6f5f4d32
branches:  chs-ubc2
changeset: 471358:eadd6f5f4d32
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Jul 04 01:35:32 1999 +0000

description:
expand splhigh() to be around the entire body of the LOCKDEBUG functions.
things could still get out of sync and cause panics as they were.

diffstat:

 sys/kern/kern_lock.c |  37 ++++++++++++++++++++++++-------------
 1 files changed, 24 insertions(+), 13 deletions(-)

diffs (114 lines):

diff -r 73aee175f6fc -r eadd6f5f4d32 sys/kern/kern_lock.c
--- a/sys/kern/kern_lock.c      Sun Jul 04 01:33:33 1999 +0000
+++ b/sys/kern/kern_lock.c      Sun Jul 04 01:35:32 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_lock.c,v 1.16.2.1.2.1 1999/06/07 04:25:30 chs Exp $       */
+/*     $NetBSD: kern_lock.c,v 1.16.2.1.2.2 1999/07/04 01:35:32 chs Exp $       */
 
 /* 
  * Copyright (c) 1995
@@ -505,6 +505,8 @@
 
        if (simplelockrecurse)
                return;
+
+       s = splhigh();
        if (alp->lock_data != SLOCK_UNLOCKED) {
                printf("simple_lock: lock held\n");
                printf("currently at: %s:%d\n", id, l);
@@ -522,18 +524,20 @@
                if (simple_lock_debugger) {
                        Debugger();
                }
+
+               splx(s);
                return;
        }
 
-       s = splhigh();
        LIST_INSERT_HEAD(&slockdebuglist, (struct simplelock *)alp, list);
-       splx(s);
-
        alp->lock_data = SLOCK_LOCKED;
        alp->lock_file = id;
        alp->lock_line = l;
+
        if (curproc)
                curproc->p_simple_locks++;
+
+       splx(s);
 }
 
 int
@@ -544,6 +548,10 @@
 {
        int s;
 
+       if (simplelockrecurse)
+               return (1);
+
+       s = splhigh();
        if (alp->lock_data != SLOCK_UNLOCKED) {
                printf("simple_lock_try: lock held\n");
                printf("currently at: %s:%d\n", id, l);
@@ -561,20 +569,20 @@
                if (simple_lock_debugger) {
                        Debugger();
                }
+
+               splx(s);
                return (0);
        }
-       if (simplelockrecurse)
-               return (1);
+
+       LIST_INSERT_HEAD(&slockdebuglist, (struct simplelock *)alp, list);
        alp->lock_data = SLOCK_LOCKED;
        alp->lock_file = id;
        alp->lock_line = l;
 
-       s = splhigh();
-       LIST_INSERT_HEAD(&slockdebuglist, (struct simplelock *)alp, list);
-       splx(s);
-
        if (curproc)
                curproc->p_simple_locks++;
+
+       splx(s);
        return (1);
 }
 
@@ -588,6 +596,8 @@
 
        if (simplelockrecurse)
                return;
+
+       s = splhigh();
        if (alp->lock_data == SLOCK_UNLOCKED) {
                printf("simple_unlock: lock not held\n");
                printf("currently at: %s:%d\n", id, l);
@@ -605,20 +615,21 @@
                if (simple_lock_debugger) {
                        Debugger();
                }
+               splx(s);
                return;
        }
 
-       s = splhigh();
        LIST_REMOVE(alp, list);
        alp->list.le_next = NULL;
        alp->list.le_prev = NULL;
-       splx(s);
-
        alp->lock_data = SLOCK_UNLOCKED;
        alp->unlock_file = id;
        alp->unlock_line = l;
+
        if (curproc)
                curproc->p_simple_locks--;
+
+       splx(s);
 }
 
 void



Home | Main Index | Thread Index | Old Index