diff options
author | Joel Becker <joel.becker@oracle.com> | 2007-06-19 14:34:03 -0400 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-07-10 20:19:43 -0400 |
commit | 16c6a4f24de2933b26477ad5dfb71f518220d641 (patch) | |
tree | dd6e1efd95d00f84a7132b8ada3314bcea730d68 /fs/ocfs2/cluster | |
parent | 14829422be6d6b6721f61b1e749acf5a9cb664d8 (diff) |
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 <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/cluster')
-rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 17 | ||||
-rw-r--r-- | fs/ocfs2/cluster/nodemanager.c | 30 | ||||
-rw-r--r-- | 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 e331f4cb2c81..2877d468f115 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) | |||
1693 | ret = -ENOENT; | 1693 | ret = -ENOENT; |
1694 | spin_unlock(&o2hb_live_lock); | 1694 | spin_unlock(&o2hb_live_lock); |
1695 | 1695 | ||
1696 | if (!ret) | 1696 | if (ret) |
1697 | ret = o2nm_depend_item(®->hr_item); | 1697 | goto out; |
1698 | |||
1699 | ret = o2nm_depend_this_node(); | ||
1700 | if (ret) | ||
1701 | goto out; | ||
1698 | 1702 | ||
1703 | ret = o2nm_depend_item(®->hr_item); | ||
1704 | if (ret) | ||
1705 | o2nm_undepend_this_node(); | ||
1706 | |||
1707 | out: | ||
1699 | return ret; | 1708 | return ret; |
1700 | } | 1709 | } |
1701 | 1710 | ||
@@ -1709,8 +1718,10 @@ static void o2hb_region_put(const char *region_uuid) | |||
1709 | 1718 | ||
1710 | spin_unlock(&o2hb_live_lock); | 1719 | spin_unlock(&o2hb_live_lock); |
1711 | 1720 | ||
1712 | if (reg) | 1721 | if (reg) { |
1713 | o2nm_undepend_item(®->hr_item); | 1722 | o2nm_undepend_item(®->hr_item); |
1723 | o2nm_undepend_this_node(); | ||
1724 | } | ||
1714 | } | 1725 | } |
1715 | 1726 | ||
1716 | int o2hb_register_callback(const char *region_uuid, | 1727 | int o2hb_register_callback(const char *region_uuid, |
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index eab46d8a7c8c..af2070da308b 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) | |||
910 | configfs_undepend_item(&o2nm_cluster_group.cs_subsys, item); | 910 | configfs_undepend_item(&o2nm_cluster_group.cs_subsys, item); |
911 | } | 911 | } |
912 | 912 | ||
913 | int o2nm_depend_this_node(void) | ||
914 | { | ||
915 | int ret = 0; | ||
916 | struct o2nm_node *local_node; | ||
917 | |||
918 | local_node = o2nm_get_node_by_num(o2nm_this_node()); | ||
919 | if (!local_node) { | ||
920 | ret = -EINVAL; | ||
921 | goto out; | ||
922 | } | ||
923 | |||
924 | ret = o2nm_depend_item(&local_node->nd_item); | ||
925 | o2nm_node_put(local_node); | ||
926 | |||
927 | out: | ||
928 | return ret; | ||
929 | } | ||
930 | |||
931 | void o2nm_undepend_this_node(void) | ||
932 | { | ||
933 | struct o2nm_node *local_node; | ||
934 | |||
935 | local_node = o2nm_get_node_by_num(o2nm_this_node()); | ||
936 | BUG_ON(!local_node); | ||
937 | |||
938 | o2nm_undepend_item(&local_node->nd_item); | ||
939 | o2nm_node_put(local_node); | ||
940 | } | ||
941 | |||
942 | |||
913 | static void __exit exit_o2nm(void) | 943 | static void __exit exit_o2nm(void) |
914 | { | 944 | { |
915 | if (ocfs2_table_header) | 945 | if (ocfs2_table_header) |
diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h index 55ae1a00d735..7c860361b8dd 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); | |||
79 | 79 | ||
80 | int o2nm_depend_item(struct config_item *item); | 80 | int o2nm_depend_item(struct config_item *item); |
81 | void o2nm_undepend_item(struct config_item *item); | 81 | void o2nm_undepend_item(struct config_item *item); |
82 | int o2nm_depend_this_node(void); | ||
83 | void o2nm_undepend_this_node(void); | ||
82 | 84 | ||
83 | #endif /* O2CLUSTER_NODEMANAGER_H */ | 85 | #endif /* O2CLUSTER_NODEMANAGER_H */ |