Module Name:    src
Committed By:   pooka
Date:           Thu May  2 16:49:08 UTC 2013

Modified Files:
        src/lib/librumpuser: rumpuser_pth.c

Log Message:
Clear rwlock's "writer" field when releasing the lock.  Otherwise it might
have been possible for "readers" to reach visibility before "writer"
when another CPU took the lock, thus leading the previous owner to
incorrectly think that it still owned the lock in rw_write_held().

Also, remove duplicate clause from assert().


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/librumpuser/rumpuser_pth.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumpuser/rumpuser_pth.c
diff -u src/lib/librumpuser/rumpuser_pth.c:1.21 src/lib/librumpuser/rumpuser_pth.c:1.22
--- src/lib/librumpuser/rumpuser_pth.c:1.21	Tue Apr 30 13:29:28 2013
+++ src/lib/librumpuser/rumpuser_pth.c	Thu May  2 16:49:08 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpuser_pth.c,v 1.21 2013/04/30 13:29:28 pooka Exp $	*/
+/*	$NetBSD: rumpuser_pth.c,v 1.22 2013/05/02 16:49:08 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.21 2013/04/30 13:29:28 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.22 2013/05/02 16:49:08 pooka Exp $");
 #endif /* !lint */
 
 #include <assert.h>
@@ -65,8 +65,9 @@ do {									\
 } while (/*CONSTCOND*/0)
 #define RURW_CLRWRITE(rw)						\
 do {									\
-	assert(rw->readers == -1 && RURW_AMWRITER(rw));			\
+	assert(RURW_AMWRITER(rw));					\
 	rw->readers = 0;						\
+	rw->writer = NULL;						\
 } while (/*CONSTCOND*/0)
 #define RURW_INCREAD(rw)						\
 do {									\

Reply via email to