I noticed the following bits of code in lck.c:
- list_p = resource->pr_pending_list_head.next;
- list_del (&resource->pr_pending_list_head);
- list_add_tail (list_p,
- &resource->pr_granted_list_head);
In unlock_algorithm, this should remove all pending locks
from pr_pending_list and append them to pr_granted_list.
However list_del on the list_head leads to the following code looping
forever:
- for (list = resource->pr_pending_list_head.next;
- list != &resource->pr_pending_list_head;
- list = list->next) {
When this happens aisexec cpu-loops forever and does not answer to anyone.
The attached patch replaces the for() loop followed by list_del(head)
with a while(!list_empty) loop adding nodes to pr_granted_list as they come.
same method as in lck_lib_exit_fn (while (!list_empty(..)))
Does it achieve the expected behaviour ?
--
\o/ Pascal Bouchareine - Gandi
g 0170393757 15, place de la Nation - 75011 Paris
Index: lck.c
===================================================================
--- lck.c (revision 1480)
+++ lck.c (working copy)
@@ -1063,8 +1063,7 @@
struct resource_lock *resource_lock)
{
struct resource_lock *resource_lock_grant;
- struct list_head *list;
- struct list_head *list_p;
+ struct list_head *pending_list;
/*
* If unlocking the ex lock, reset ex granted
@@ -1107,31 +1106,23 @@
* Couldn't assign EX lock, so assign any pending PR locks
*/
if (resource->ex_granted == 0) {
- if (list_empty (&resource->pr_pending_list_head) == 0) {
- /*
- * assign all pr pending locks to pr granted lock list
- */
-
- for (list = resource->pr_pending_list_head.next;
- list != &resource->pr_pending_list_head;
- list = list->next) {
-
- resource_lock_grant = list_entry (list, struct
resource_lock, list);
+ pending_list = resource->pr_pending_list_head.next;
+ while (!list_empty(pending_list)) {
+ resource_lock_grant = list_entry(pending_list,
struct resource_lock, list);
resource_lock_grant->lock_status =
SA_LCK_LOCK_GRANTED;
- lock_response_deliver (
- &resource_lock_grant->response_source,
- resource_lock_grant,
- SA_AIS_OK);
- }
+ /*
+ * Add pending locks to granted list
+ */
+ list_del (&resource_lock_grant->list);
+ list_add_tail (&resource_lock_grant->list,
+
&resource->pr_granted_list_head);
- /*
- * Add pending locks to granted list
- */
- list_p = resource->pr_pending_list_head.next;
- list_del (&resource->pr_pending_list_head);
- list_add_tail (list_p,
- &resource->pr_granted_list_head);
+ lock_response_deliver (
+
&resource_lock_grant->response_source,
+
resource_lock_grant,
+ SA_AIS_OK);
+ pending_list =
resource->pr_pending_list_head.next;
}
}
}
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais