[Ocfs2-commits] jlbec commits r2797 - branches/ocfs2-1.2-cert/patches

svn-commits@oss.oracle.com svn-commits at oss.oracle.com
Tue Mar 28 20:24:36 CST 2006


Author: jlbec
Signed-off-by: khackel
Date: 2006-03-28 20:24:35 -0600 (Tue, 28 Mar 2006)
New Revision: 2797

Added:
   branches/ocfs2-1.2-cert/patches/never-purge-master.patch
   branches/ocfs2-1.2-cert/patches/reassert-vs-migration.patch
Modified:
   branches/ocfs2-1.2-cert/patches/series
Log:

o Keep locks we master about.
o Make sure that migration and assertions of our domination never
  conflict.

Signed-off-by: khackel



Added: branches/ocfs2-1.2-cert/patches/never-purge-master.patch
===================================================================
--- branches/ocfs2-1.2-cert/patches/never-purge-master.patch	2006-03-28 19:27:56 UTC (rev 2796)
+++ branches/ocfs2-1.2-cert/patches/never-purge-master.patch	2006-03-29 02:24:35 UTC (rev 2797)
@@ -0,0 +1,54 @@
+Index: ocfs2-1.2/fs/ocfs2/dlm/dlmthread.c
+===================================================================
+--- ocfs2-1.2.orig/fs/ocfs2/dlm/dlmthread.c	2006-03-28 15:10:30.446654000 -0800
++++ ocfs2-1.2/fs/ocfs2/dlm/dlmthread.c	2006-03-28 15:17:09.805575000 -0800
+@@ -107,6 +107,21 @@ void __dlm_lockres_calc_usage(struct dlm
+ 	assert_spin_locked(&res->spinlock);
+ 
+ 	if (__dlm_lockres_unused(res)){
++		/* For now, just keep any resource we master */
++		if (res->owner == dlm->node_num)
++		{
++			if (!list_empty(&res->purge)) {
++				mlog(ML_NOTICE,
++				     "we master %s:%.*s, but it is on "
++				     "the purge list.  Removing\n",
++				     dlm->name, res->lockname.len,
++				     res->lockname.name);
++				list_del_init(&res->purge);
++				dlm->purge_count--;
++			}
++			return;
++		}
++
+ 		if (list_empty(&res->purge)) {
+ 			mlog(0, "putting lockres %.*s from purge list\n",
+ 			     res->lockname.len, res->lockname.name);
+Index: ocfs2-1.2/fs/ocfs2/dlm/dlmlock.c
+===================================================================
+--- ocfs2-1.2.orig/fs/ocfs2/dlm/dlmlock.c	2006-03-28 16:59:05.728623000 -0800
++++ ocfs2-1.2/fs/ocfs2/dlm/dlmlock.c	2006-03-28 16:59:31.088542000 -0800
+@@ -226,14 +226,18 @@ static enum dlm_status dlmlock_remote(st
+ 	res->state &= ~DLM_LOCK_RES_IN_PROGRESS;
+ 	lock->lock_pending = 0;
+ 	if (status != DLM_NORMAL) {
+-		if (status != DLM_NOTQUEUED)
++		if (status != DLM_NOTQUEUED) {
++			/*
++			 * DO NOT call calc_usage, as this would unhash
++			 * the remote lockres before we ever get to use
++			 * it.  treat as if we never made any change to
++			 * the lockres.
++			 */
++			lockres_changed = 0;
+ 			dlm_error(status);
++		}
+ 		dlm_revert_pending_lock(res, lock);
+ 		dlm_lock_put(lock);
+-		/* do NOT call calc_usage, as this would unhash the remote
+-		 * lockres before we ever get to use it.  treat as if we
+-		 * never made any change to the lockres. */
+-		lockres_changed = 0;
+ 	} else if (dlm_is_recovery_lock(res->lockname.name, 
+ 					res->lockname.len)) {
+ 		/* special case for the $RECOVERY lock.

Added: branches/ocfs2-1.2-cert/patches/reassert-vs-migration.patch
===================================================================
--- branches/ocfs2-1.2-cert/patches/reassert-vs-migration.patch	2006-03-28 19:27:56 UTC (rev 2796)
+++ branches/ocfs2-1.2-cert/patches/reassert-vs-migration.patch	2006-03-29 02:24:35 UTC (rev 2797)
@@ -0,0 +1,40 @@
+Index: ocfs2-1.2/fs/ocfs2/dlm/dlmmaster.c
+===================================================================
+--- ocfs2-1.2.orig/fs/ocfs2/dlm/dlmmaster.c	2006-03-28 15:10:30.523654000 -0800
++++ ocfs2-1.2/fs/ocfs2/dlm/dlmmaster.c	2006-03-28 18:05:33.960016000 -0800
+@@ -2056,6 +2056,24 @@ void dlm_assert_master_worker(struct dlm
+ 		}
+ 	}
+ 
++	/*
++	 * If we're migrating this lock to someone else, we are no
++	 * longer allowed to assert out own mastery.  OTOH, we need to
++	 * prevent migration from starting while we're still asserting
++	 * our dominance.  The reserved ast delays migration.
++	 */
++	spin_lock(&res->spinlock);
++	if (res->state & DLM_LOCK_RES_MIGRATING) {
++		mlog(ML_NOTICE,
++		     "Someone asked us to assert mastery, but we're "
++		     "in the middle of migration.  Skipping assert, "
++		     "the new master will handle that.\n");
++		spin_unlock(&res->spinlock);
++		goto put;
++	} else
++		__dlm_lockres_reserve_ast(res);
++	spin_unlock(&res->spinlock);
++
+ 	/* this call now finishes out the nodemap
+ 	 * even if one or more nodes die */
+ 	mlog(0, "worker about to master %.*s here, this=%u\n",
+@@ -2068,6 +2086,10 @@ void dlm_assert_master_worker(struct dlm
+ 		mlog_errno(ret);
+ 	}
+ 
++	/* Ok, we've asserted ourselves.  Let's let migration start. */
++	dlm_lockres_release_ast(dlm, res);
++
++put:
+ 	dlm_lockres_put(res);
+ 
+ 	mlog(0, "finished with dlm_assert_master_worker\n");

Modified: branches/ocfs2-1.2-cert/patches/series
===================================================================
--- branches/ocfs2-1.2-cert/patches/series	2006-03-28 19:27:56 UTC (rev 2796)
+++ branches/ocfs2-1.2-cert/patches/series	2006-03-29 02:24:35 UTC (rev 2797)
@@ -17,3 +17,5 @@
 fix-recovery-spin.patch
 fix-dlmlock_remote.patch
 ocfs2_heartbeat-better_I_O_error_handling.patch -p0
+never-purge-master.patch 
+reassert-vs-migration.patch 




More information about the Ocfs2-commits mailing list