aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/cluster
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2007-02-03 06:14:30 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2007-03-14 17:37:09 -0400
commitc24f72cc7ca829bbad0532ddf315ace3ae1c359e (patch)
treef52e199ba3e426d0713be8d401a1c53336f47b8b /fs/ocfs2/cluster
parentc3442e296517aee733d62fc3fe03211598902c7d (diff)
ocfs2: Proper cleanup in case of error in ocfs2_register_hb_callbacks()
If ocfs2_register_hb_callbacks() succeeds on its first callback but fails its second, it doesn't release the first on the way out. Fix that. While we're at it, o2hb_unregister_callback() never returns anything but 0, so let's make it void. 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.c6
-rw-r--r--fs/ocfs2/cluster/heartbeat.h2
-rw-r--r--fs/ocfs2/cluster/tcp.c13
3 files changed, 5 insertions, 16 deletions
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 5a9779bb9236..0f2cfecd42c0 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1682,7 +1682,7 @@ out:
1682} 1682}
1683EXPORT_SYMBOL_GPL(o2hb_register_callback); 1683EXPORT_SYMBOL_GPL(o2hb_register_callback);
1684 1684
1685int o2hb_unregister_callback(struct o2hb_callback_func *hc) 1685void o2hb_unregister_callback(struct o2hb_callback_func *hc)
1686{ 1686{
1687 BUG_ON(hc->hc_magic != O2HB_CB_MAGIC); 1687 BUG_ON(hc->hc_magic != O2HB_CB_MAGIC);
1688 1688
@@ -1690,15 +1690,13 @@ int o2hb_unregister_callback(struct o2hb_callback_func *hc)
1690 __builtin_return_address(0), hc); 1690 __builtin_return_address(0), hc);
1691 1691
1692 if (list_empty(&hc->hc_item)) 1692 if (list_empty(&hc->hc_item))
1693 return 0; 1693 return;
1694 1694
1695 down_write(&o2hb_callback_sem); 1695 down_write(&o2hb_callback_sem);
1696 1696
1697 list_del_init(&hc->hc_item); 1697 list_del_init(&hc->hc_item);
1698 1698
1699 up_write(&o2hb_callback_sem); 1699 up_write(&o2hb_callback_sem);
1700
1701 return 0;
1702} 1700}
1703EXPORT_SYMBOL_GPL(o2hb_unregister_callback); 1701EXPORT_SYMBOL_GPL(o2hb_unregister_callback);
1704 1702
diff --git a/fs/ocfs2/cluster/heartbeat.h b/fs/ocfs2/cluster/heartbeat.h
index cac6223206a9..cc6d40b39771 100644
--- a/fs/ocfs2/cluster/heartbeat.h
+++ b/fs/ocfs2/cluster/heartbeat.h
@@ -70,7 +70,7 @@ void o2hb_setup_callback(struct o2hb_callback_func *hc,
70 void *data, 70 void *data,
71 int priority); 71 int priority);
72int o2hb_register_callback(struct o2hb_callback_func *hc); 72int o2hb_register_callback(struct o2hb_callback_func *hc);
73int o2hb_unregister_callback(struct o2hb_callback_func *hc); 73void o2hb_unregister_callback(struct o2hb_callback_func *hc);
74void o2hb_fill_node_map(unsigned long *map, 74void o2hb_fill_node_map(unsigned long *map,
75 unsigned bytes); 75 unsigned bytes);
76void o2hb_init(void); 76void o2hb_init(void);
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 1718215fc018..69caf3e12fea 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -1638,17 +1638,8 @@ static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num,
1638 1638
1639void o2net_unregister_hb_callbacks(void) 1639void o2net_unregister_hb_callbacks(void)
1640{ 1640{
1641 int ret; 1641 o2hb_unregister_callback(&o2net_hb_up);
1642 1642 o2hb_unregister_callback(&o2net_hb_down);
1643 ret = o2hb_unregister_callback(&o2net_hb_up);
1644 if (ret < 0)
1645 mlog(ML_ERROR, "Status return %d unregistering heartbeat up "
1646 "callback!\n", ret);
1647
1648 ret = o2hb_unregister_callback(&o2net_hb_down);
1649 if (ret < 0)
1650 mlog(ML_ERROR, "Status return %d unregistering heartbeat down "
1651 "callback!\n", ret);
1652} 1643}
1653 1644
1654int o2net_register_hb_callbacks(void) 1645int o2net_register_hb_callbacks(void)