[Ocfs2-commits] khackel commits r1954 - trunk/fs/ocfs2/dlm
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Mar 7 16:22:21 CST 2005
Author: khackel
Signed-off-by: mfasheh
Date: 2005-03-07 16:22:19 -0600 (Mon, 07 Mar 2005)
New Revision: 1954
Modified:
trunk/fs/ocfs2/dlm/dlmmaster.c
Log:
* Merged 1936 from dlm-reco-mig branch
- [1936] 3 mle-related fixes
Signed-off-by: mfasheh
Modified: trunk/fs/ocfs2/dlm/dlmmaster.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmmaster.c 2005-03-07 19:30:18 UTC (rev 1953)
+++ trunk/fs/ocfs2/dlm/dlmmaster.c 2005-03-07 22:22:19 UTC (rev 1954)
@@ -257,8 +257,10 @@
if (mle->type == DLM_MLE_MASTER)
mle->u.res = res;
- else
+ else {
strncpy(mle->u.name.name, name, namelen);
+ mle->u.name.len = namelen;
+ }
/* copy off the node_map and register hb callbacks on our copy */
memcpy(mle->node_map, dlm->node_map, sizeof(mle->node_map));
@@ -845,7 +847,8 @@
dlm_master_list_entry *mle = NULL, *tmpmle = NULL;
char *name;
unsigned int namelen;
- int found;
+ int found, ret, bit;
+ unsigned long nodemap[BITS_TO_LONGS(NM_MAX_NODES)];
if (!dlm_grab(dlm))
return DLM_MASTER_RESP_NO;
@@ -863,6 +866,17 @@
spin_lock(&dlm->spinlock);
res = __dlm_lookup_lock(dlm, name, namelen);
if (res) {
+ /* while we still have the dlm->spinlock,
+ * save off the node map and clear out
+ * all nodes from this node forward, and
+ * the node that called us */
+ memcpy(nodemap, dlm->node_map, sizeof(nodemap));
+ clear_bit(request->node_idx, nodemap);
+ clear_bit(dlm->group_index, nodemap);
+ while ((bit = find_next_bit(nodemap, NM_MAX_NODES,
+ dlm->group_index)) < NM_MAX_NODES) {
+ clear_bit(bit, nodemap);
+ }
spin_unlock(&dlm->spinlock);
/* take care of the easy cases up front */
@@ -873,6 +887,16 @@
response = DLM_MASTER_RESP_YES;
if (mle)
kfree(mle);
+
+ /* this node is the owner.
+ * there is some extra work that needs to
+ * happen now. the requesting node has
+ * caused all nodes up to this one to
+ * create mles. this node now needs to
+ * go back and clean those up. */
+ ret = dlm_do_assert_master(dlm, res->lockname.name,
+ res->lockname.len,
+ nodemap);
goto send_response;
} else if (res->owner != DLM_LOCK_RES_OWNER_UNKNOWN) {
spin_unlock(&res->spinlock);
@@ -998,6 +1022,7 @@
dlm_node_iter iter;
int ret = 0;
+ /* note that if this nodemap is empty, it returns 0 */
dlm_node_iter_init(nodemap, &iter);
while ((to = dlm_node_iter_next(&iter)) >= 0) {
// dlmprintk("sending assert master to %d\n", to);
@@ -1124,10 +1149,14 @@
wake_up(&mle->wq);
spin_unlock(&mle->spinlock);
- /* if this is the last put, it will be removed from the list */
/* master is known, detach if not already detached */
dlm_mle_detach_hb_events(dlm, mle);
dlm_put_mle(mle);
+ /* the assert master message now balances the extra
+ * ref given by the master request message.
+ * if this is the last put, it will be removed
+ * from the list. */
+ dlm_put_mle(mle);
}
done:
More information about the Ocfs2-commits
mailing list