Skip site navigation (1)Skip section navigation (2)
Date:      09 Nov 1999 13:03:03 +0100
From:      Assar Westerlund <assar@sics.se>
To:        current@freebsd.org
Subject:   inconsistent and wrong locking in asleep()
Message-ID:  <5l4sevrhxk.fsf@assaris.sics.se>

next in thread | raw e-mail | index | archive | help
[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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5l4sevrhxk.fsf>