[Ocfs2-commits] mfasheh commits r1750 - trunk/cluster
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Jan 7 20:58:37 CST 2005
Author: mfasheh
Date: 2005-01-07 20:58:35 -0600 (Fri, 07 Jan 2005)
New Revision: 1750
Modified:
trunk/cluster/dlmthread.c
Log:
* dlmthread fixes:
- set ourselves woken *before* processing the dirty list. This way, if
items are added after processing, but before we hit
wait_event_interruptible, we won't go to sleep and will
continue to do work.
- pull an item *off* the list before processing it. this way, another
thread wanting to put it on the list just after our processing is
complete won't have it blindly removed.
- use wait_event_interruptible as (after the above fixes), we don't
currently need a timeout in this function and as a result, it simplifies
the code.
* add a bit of tracing in dlm_shuffle_lists which I found usefull when
trying to debug things.
Modified: trunk/cluster/dlmthread.c
===================================================================
--- trunk/cluster/dlmthread.c 2005-01-08 02:41:50 UTC (rev 1749)
+++ trunk/cluster/dlmthread.c 2005-01-08 02:58:35 UTC (rev 1750)
@@ -72,6 +72,8 @@
struct list_head *head;
s8 hi;
+ dlmprintk("shuffle res %*s\n", res->lockname.len, res->lockname.name);
+
spin_lock(&res->spinlock);
#if 0
@@ -93,6 +95,9 @@
converting:
if (list_empty(&res->converting))
goto blocked;
+ dlmprintk("res %*s has locks on a convert queue\n", res->lockname.len,
+ res->lockname.name);
+
target = list_entry(res->converting.next, dlm_lock, list);
if (target->convert_type == LKM_IVMODE) {
dlmprintk0("eeek!!! converting a lock with no convert_type!!!!\n");
@@ -213,6 +218,8 @@
list_del(&lock->ast_list);
spin_unlock(&lock->spinlock);
+ dlmprintk("delivering a bast for this lockres (blocked = %d\n",
+ hi);
if (dlm_do_bast(dlm, res, lock, hi) < 0)
dlmprintk0("eeek\n");
}
@@ -266,7 +273,6 @@
int dlm_thread(void *data)
{
- int status;
struct list_head *iter, *tmpiter;
dlm_lock_resource *res;
dlm_ctxt *dlm = data;
@@ -275,6 +281,8 @@
dlm->thread.task = current;
while (1) {
+ atomic_set(&dlm->thread.woken, 0);
+
down_read(&dlm->recovery_sem);
spin_lock(&dlm->spinlock);
list_for_each_safe(iter, tmpiter, &dlm->dirty_list) {
@@ -282,32 +290,23 @@
/* don't shuffle secondary queues */
if (res->owner != dlm->group_index)
continue;
- dlm_shuffle_lists(dlm, res);
spin_lock(&res->spinlock);
list_del(&res->dirty);
res->state &= ~DLM_LOCK_RES_DIRTY;
spin_unlock(&res->spinlock);
+
+ dlm_shuffle_lists(dlm, res);
}
spin_unlock(&dlm->spinlock);
up_read(&dlm->recovery_sem);
-
- atomic_set(&dlm->thread.woken, 0);
- status = util_wait_atomic_eq(&dlm->thread.thread_wq,
- &dlm->thread.woken,
- 1, DLM_THREAD_MS);
- if (status == 0 || status == -ETIMEDOUT) {
-#if 0
- if (atomic_read(&dlm->thread.woken))
- dlmprintk0("aha!!! dlm thread woken!\n");
- else
- dlmprintk0("timed out waiting, running again\n");
-#endif
- continue;
+ wait_event_interruptible(dlm->thread.thread_wq,
+ atomic_read(&dlm->thread.woken));
+
+ if (signal_pending(current)) {
+ dlmprintk("DLM thread got signal while waiting\n");
+ break;
}
-
- dlmprintk("DLM thread got %d while waiting\n", status);
- break;
}
flush_scheduled_work();
More information about the Ocfs2-commits
mailing list