[Openais] [PATCH]: openais/trunk: Send response immediately if lock status is NOT_QUEUED

Ryan O'Hara rohara at redhat.com
Tue Jun 9 12:25:12 PDT 2009


If a lock request specifies the SA_LCK_LOCK_NO_QUEUE flag and the
request is blocked, the lock is not queued and lock_status is set to
SA_LCK_LOCK_NOT_QUEUED and a response should be sent to the library.

The existing code does not send a response to the library as
needed. In short, the existing code could create a timer (and the call
would block) whenever the status != SA_LCK_LOCK_GRANTED. This patch
fixes the problem.

Thanks for Honzaf for finding this bug.

Ryan

-------------- next part --------------
Index: lck.c
===================================================================
--- lck.c	(revision 1949)
+++ lck.c	(working copy)
@@ -2349,7 +2349,10 @@
 error_exit:
 	if (api->ipc_source_is_local (&req_exec_lck_resourcelock->source))
 	{
-		if ((lock != NULL) && (lock->lock_status != SA_LCK_LOCK_GRANTED)) {
+		if ((lock != NULL) &&
+		    (lock->lock_status != SA_LCK_LOCK_GRANTED) &&
+		    (lock->lock_status != SA_LCK_LOCK_NOT_QUEUED))
+		{
 			api->timer_add_duration (
 				req_exec_lck_resourcelock->timeout, (void *)(lock),
 				lck_resourcelock_timeout, &lock->timer_handle);


More information about the Openais mailing list