From owner-freebsd-current Tue Nov 9 4: 2: 6 1999 Delivered-To: freebsd-current@freebsd.org Received: from assaris.sics.se (assaris.sics.se [193.10.66.108]) by hub.freebsd.org (Postfix) with ESMTP id 6EFEE14D4A for ; Tue, 9 Nov 1999 04:02:00 -0800 (PST) (envelope-from assar@sics.se) Received: (from assar@localhost) by assaris.sics.se (8.9.3/8.7.3) id NAA08687; Tue, 9 Nov 1999 13:03:03 +0100 (CET) To: current@freebsd.org Subject: inconsistent and wrong locking in asleep() Mime-Version: 1.0 (generated by tm-edit 7.68) Content-Type: text/plain; charset=US-ASCII From: Assar Westerlund Date: 09 Nov 1999 13:03:03 +0100 Message-ID: <5l4sevrhxk.fsf@assaris.sics.se> Lines: 27 X-Mailer: Gnus v5.5/Emacs 19.34 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG [re-sending a mail that went unanswered by -hackers] Why trying to debug some locking code of my own I enabled SIMPLELOCK_DEBUG, only to find out that I was getting lots of `simple_unlock: lock not held' in lockmgr -> acquire -> apause. Looking closer at `apause' it seems rather clear that it can cause this. I proposed simple change is below. Comments? /assar --- kern_lock.c.orig Mon Nov 8 03:55:26 1999 +++ kern_lock.c Mon Nov 8 04:24:13 1999 @@ -116,9 +119,11 @@ simple_lock(&lkp->lk_interlock); if ((lkp->lk_flags & flags) == 0) return 0; + simple_unlock(&lkp->lk_interlock); break; } } + simple_lock(&lkp->lk_interlock); } return 1; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message