[Ocfs2-commits] mfasheh commits r2351 - trunk/fs/ocfs2/dlm
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Jun 1 18:37:16 CDT 2005
Author: mfasheh
Signed-off-by: zab
Date: 2005-06-01 18:37:15 -0500 (Wed, 01 Jun 2005)
New Revision: 2351
Modified:
trunk/fs/ocfs2/dlm/dlmdomain.c
trunk/fs/ocfs2/dlm/dlmdomain.h
trunk/fs/ocfs2/dlm/dlmthread.c
Log:
* don't wait to purge lockres' during domain shutdown
* keep lockres' on the purge list in chronological order. this allows
dlm_run_purge_list to shortcut out at the 1st unpurgable lockres.
Signed-off-by: zab
Modified: trunk/fs/ocfs2/dlm/dlmdomain.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmdomain.c 2005-06-01 23:15:25 UTC (rev 2350)
+++ trunk/fs/ocfs2/dlm/dlmdomain.c 2005-06-01 23:37:15 UTC (rev 2351)
@@ -498,6 +498,20 @@
spin_unlock(&dlm->spinlock);
}
+int dlm_shutting_down(dlm_ctxt *dlm)
+{
+ int ret = 0;
+
+ spin_lock(&dlm_domain_lock);
+
+ if (dlm->dlm_state == DLM_CTXT_IN_SHUTDOWN)
+ ret = 1;
+
+ spin_unlock(&dlm_domain_lock);
+
+ return ret;
+}
+
void dlm_unregister_domain(dlm_ctxt *dlm)
{
int leave = 0;
@@ -523,6 +537,10 @@
if (leave) {
mlog(0, "shutting down domain %s\n", dlm->name);
+
+ /* We changed dlm state, notify the thread */
+ dlm_kick_thread(dlm, NULL);
+
dlm_migrate_all_locks(dlm);
dlm_mark_domain_leaving(dlm);
dlm_leave_domain(dlm);
Modified: trunk/fs/ocfs2/dlm/dlmdomain.h
===================================================================
--- trunk/fs/ocfs2/dlm/dlmdomain.h 2005-06-01 23:15:25 UTC (rev 2350)
+++ trunk/fs/ocfs2/dlm/dlmdomain.h 2005-06-01 23:37:15 UTC (rev 2351)
@@ -29,5 +29,6 @@
extern struct list_head dlm_domains;
dlm_ctxt * __dlm_lookup_domain(const char *domain);
+int dlm_shutting_down(dlm_ctxt *dlm);
#endif
Modified: trunk/fs/ocfs2/dlm/dlmthread.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmthread.c 2005-06-01 23:15:25 UTC (rev 2350)
+++ trunk/fs/ocfs2/dlm/dlmthread.c 2005-06-01 23:37:15 UTC (rev 2351)
@@ -47,6 +47,7 @@
#include "dlmapi.h"
#include "dlmcommon.h"
+#include "dlmdomain.h"
#define MLOG_MASK_PREFIX (ML_DLM|ML_DLM_THREAD)
#include "cluster/masklog.h"
@@ -194,7 +195,8 @@
__dlm_unhash_lockres(lockres);
}
-static void dlm_run_purge_list(dlm_ctxt *dlm)
+static void dlm_run_purge_list(dlm_ctxt *dlm,
+ int purge_now)
{
unsigned int run_max, unused;
unsigned long purge_jiffies;
@@ -208,8 +210,6 @@
lockres = list_entry(dlm->purge_list.next,
dlm_lock_resource, purge);
- list_del_init(&lockres->purge);
- dlm->purge_count--;
/* Status of the lockres *might* change so double
* check. If the lockres is unused, holding the dlm
@@ -228,18 +228,25 @@
/* Make sure that we want to be processing this guy at
* this time. */
- if (time_after(purge_jiffies, jiffies)) {
- /* re-add to be processed at a later date. */
- list_add_tail(&lockres->purge, &dlm->purge_list);
- dlm->purge_count++;
- continue;
+ if (!purge_now && time_after(purge_jiffies, jiffies)) {
+ /* Since resources are added to the purge list
+ * in tail order, we can stop at the first
+ * unpurgable resource -- anyone added after
+ * him will have a greater last_used value */
+ break;
}
+ list_del_init(&lockres->purge);
+ dlm->purge_count--;
+
/* This may drop and reacquire the dlm spinlock if it
* has to do migration. */
mlog(0, "calling dlm_purge_lockres!\n");
dlm_purge_lockres(dlm, lockres);
mlog(0, "DONE calling dlm_purge_lockres!\n");
+
+ /* Avoid adding any scheduling latencies */
+ cond_resched_lock(&dlm->spinlock);
}
spin_unlock(&dlm->spinlock);
@@ -586,7 +593,11 @@
while (!kthread_should_stop()) {
int n = DLM_THREAD_MAX_DIRTY;
- dlm_run_purge_list(dlm);
+ /* dlm_shutting_down is very point-in-time, but that
+ * doesn't matter as we'll just loop back around if we
+ * get false on the leading edge of a state
+ * transition. */
+ dlm_run_purge_list(dlm, dlm_shutting_down(dlm));
down_read(&dlm->recovery_sem);
More information about the Ocfs2-commits
mailing list