Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=16c6a4f24de2933b26477ad5dfb71f518220d641
Commit:     16c6a4f24de2933b26477ad5dfb71f518220d641
Parent:     14829422be6d6b6721f61b1e749acf5a9cb664d8
Author:     Joel Becker <[EMAIL PROTECTED]>
AuthorDate: Tue Jun 19 11:34:03 2007 -0700
Committer:  Mark Fasheh <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 17:19:43 2007 -0700

    ocfs2: live heartbeat depends on the local node configuration
    
    Removing the local node configuration out from underneath a running
    heartbeat is "bad".  Provide an API in the ocfs2 nodemanager to request
    a configfs dependancy on the local node, then use it in heartbeat.
    
    Signed-off-by: Joel Becker <[EMAIL PROTECTED]>
    Signed-off-by: Mark Fasheh <[EMAIL PROTECTED]>
---
 fs/ocfs2/cluster/heartbeat.c   |   17 ++++++++++++++---
 fs/ocfs2/cluster/nodemanager.c |   30 ++++++++++++++++++++++++++++++
 fs/ocfs2/cluster/nodemanager.h |    2 ++
 3 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index e331f4c..2877d46 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1693,9 +1693,18 @@ static int o2hb_region_get(const char *region_uuid)
                ret = -ENOENT;
        spin_unlock(&o2hb_live_lock);
 
-       if (!ret)
-               ret = o2nm_depend_item(&reg->hr_item);
+       if (ret)
+               goto out;
+
+       ret = o2nm_depend_this_node();
+       if (ret)
+               goto out;
 
+       ret = o2nm_depend_item(&reg->hr_item);
+       if (ret)
+               o2nm_undepend_this_node();
+
+out:
        return ret;
 }
 
@@ -1709,8 +1718,10 @@ static void o2hb_region_put(const char *region_uuid)
 
        spin_unlock(&o2hb_live_lock);
 
-       if (reg)
+       if (reg) {
                o2nm_undepend_item(&reg->hr_item);
+               o2nm_undepend_this_node();
+       }
 }
 
 int o2hb_register_callback(const char *region_uuid,
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index eab46d8..af2070d 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -910,6 +910,36 @@ void o2nm_undepend_item(struct config_item *item)
        configfs_undepend_item(&o2nm_cluster_group.cs_subsys, item);
 }
 
+int o2nm_depend_this_node(void)
+{
+       int ret = 0;
+       struct o2nm_node *local_node;
+
+       local_node = o2nm_get_node_by_num(o2nm_this_node());
+       if (!local_node) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       ret = o2nm_depend_item(&local_node->nd_item);
+       o2nm_node_put(local_node);
+
+out:
+       return ret;
+}
+
+void o2nm_undepend_this_node(void)
+{
+       struct o2nm_node *local_node;
+
+       local_node = o2nm_get_node_by_num(o2nm_this_node());
+       BUG_ON(!local_node);
+
+       o2nm_undepend_item(&local_node->nd_item);
+       o2nm_node_put(local_node);
+}
+
+
 static void __exit exit_o2nm(void)
 {
        if (ocfs2_table_header)
diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h
index 55ae1a0..7c86036 100644
--- a/fs/ocfs2/cluster/nodemanager.h
+++ b/fs/ocfs2/cluster/nodemanager.h
@@ -79,5 +79,7 @@ void o2nm_node_put(struct o2nm_node *node);
 
 int o2nm_depend_item(struct config_item *item);
 void o2nm_undepend_item(struct config_item *item);
+int o2nm_depend_this_node(void);
+void o2nm_undepend_this_node(void);
 
 #endif /* O2CLUSTER_NODEMANAGER_H */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to