[Openais] [PATCH]: openais/trunk: Use list_splice when grant pending PR locks
Ryan O'Hara
rohara at redhat.com
Thu Jun 11 09:59:24 PDT 2009
The lck_unlock routine will grant pending locks. When those locks are
pending PR locks, we grant all of them.
This patch uses list_splice to pending PR lock requests from
pr_lock_pending_list_head to pr_lock_granted_list_head. Not only is
this method cleaner, but it also fixes a memory error that was showing
up in valgrind.
-------------- next part --------------
Index: lck.c
===================================================================
--- lck.c (revision 1952)
+++ lck.c (working copy)
@@ -1883,9 +1883,6 @@
lock = list_entry (list, struct resource_lock, list);
lock->lock_status = SA_LCK_LOCK_GRANTED;
- /* list_del (&lock->list); */
- /* list_add_tail (&lock->list, &resource->pr_lock_granted_list_head); */
-
if (lock->timer_handle != 0) {
api->timer_delete (lock->timer_handle);
lck_resourcelock_response_send (lock, SA_AIS_OK);
@@ -1898,10 +1895,10 @@
/*
* Move pending shared locks to granted list.
*/
- list = resource->pr_lock_pending_list_head.next;
- list_del (&resource->pr_lock_pending_list_head);
+ list_splice (&resource->pr_lock_pending_list_head,
+ &resource->pr_lock_granted_list_head);
+
list_init (&resource->pr_lock_pending_list_head);
- list_add_tail (list, &resource->pr_lock_granted_list_head);
}
}
}
More information about the Openais
mailing list