[Ocfs2-commits] khackel commits r1936 -
branches/dlm-reco-mig/fs/ocfs2/dlm
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Mar 2 20:15:59 CST 2005
Author: khackel
Date: 2005-03-02 20:15:58 -0600 (Wed, 02 Mar 2005)
New Revision: 1936
Modified:
branches/dlm-reco-mig/fs/ocfs2/dlm/dlmmaster.c
Log:
3 mle-related fixes:
* fix bug in dlm_init_mle where BLOCK mles were not getting the name
and length copied properly
* fix bug in dlm_master_request_handler where master node responding
YES to a master request was not clearing the mles on other nodes
as it should have been
* fix dlm_assert_master_handler to properly put one additional ref
back on BLOCK mles when this assert master message is received
Modified: branches/dlm-reco-mig/fs/ocfs2/dlm/dlmmaster.c
===================================================================
--- branches/dlm-reco-mig/fs/ocfs2/dlm/dlmmaster.c 2005-03-03 02:11:03 UTC (rev 1935)
+++ branches/dlm-reco-mig/fs/ocfs2/dlm/dlmmaster.c 2005-03-03 02:15:58 UTC (rev 1936)
@@ -257,8 +257,11 @@
if (mle->type == DLM_MLE_MASTER)
mle->u.res = res;
- else
+ else {
+ memset(mle->u.name.name, 0, DLM_LOCKID_NAME_MAX);
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 +848,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 +867,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 +888,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 +1023,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 +1150,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