Index: /trunk/ccl/level-1/linux-files.lisp
===================================================================
--- /trunk/ccl/level-1/linux-files.lisp	(revision 511)
+++ /trunk/ccl/level-1/linux-files.lisp	(revision 512)
@@ -912,6 +912,5 @@
 	(append-dll-node request (shared-resource-requestors resource)))
       (wait-on-semaphore (shared-resource-request-signal request))
-      #+debug
-      (assert (eq current (shared-resource-current-owner request)))
+      (assert (eq current (shared-resource-current-owner resource)))
       (when verbose
 	(format t "~%~%;;;~%;;; ~a is now owned by ~a~%;;;~%~%"
@@ -928,8 +927,8 @@
 	     (secondary (shared-resource-current-owner r)))
 	(unless (setq not-any-owner
-		      (or (eq current secondary)
-			  (and (null secondary)
-			       (eq current primary))))
-	  (when secondary
+		      (not (or (eq current secondary)
+                               (and (null secondary)
+                                    (eq current primary)))))
+	  (when (eq current secondary)
 	    (setf (shared-resource-current-owner r) nil)
 	    (signal-semaphore (shared-resource-primary-owner-notify r))))))
@@ -959,8 +958,10 @@
 	  (when request
 	    (remove-dll-node request)
+            (setf (shared-resource-current-owner r)
+                  (shared-resource-request-process request))
 	    (signal-semaphore (shared-resource-request-signal request))))))
     (when request
       (wait-on-semaphore (shared-resource-primary-owner-notify r))
-      (format t "~&;;;~%;;;control of ~a restored to ~a~%;;;~&"
+      (format t "~%;;;~%;;;control of ~a restored to ~a~%;;;~&"
 	      (shared-resource-name r)
 	      *current-process*))))
