Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c24f72cc7ca829bbad0532ddf315ace3ae1c359e
Commit:     c24f72cc7ca829bbad0532ddf315ace3ae1c359e
Parent:     c3442e296517aee733d62fc3fe03211598902c7d
Author:     Joel Becker <[EMAIL PROTECTED]>
AuthorDate: Sat Feb 3 03:14:30 2007 -0800
Committer:  Mark Fasheh <[EMAIL PROTECTED]>
CommitDate: Wed Mar 14 14:37:09 2007 -0700

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Mark Fasheh <[EMAIL PROTECTED]>
---
 fs/ocfs2/cluster/heartbeat.c |    6 ++----
 fs/ocfs2/cluster/heartbeat.h |    2 +-
 fs/ocfs2/cluster/tcp.c       |   13 ++-----------
 fs/ocfs2/heartbeat.c         |   15 +++++----------
 4 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 5a9779b..0f2cfec 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1682,7 +1682,7 @@ out:
 }
 EXPORT_SYMBOL_GPL(o2hb_register_callback);
 
-int o2hb_unregister_callback(struct o2hb_callback_func *hc)
+void o2hb_unregister_callback(struct o2hb_callback_func *hc)
 {
        BUG_ON(hc->hc_magic != O2HB_CB_MAGIC);
 
@@ -1690,15 +1690,13 @@ int o2hb_unregister_callback(struct o2hb_callback_func 
*hc)
             __builtin_return_address(0), hc);
 
        if (list_empty(&hc->hc_item))
-               return 0;
+               return;
 
        down_write(&o2hb_callback_sem);
 
        list_del_init(&hc->hc_item);
 
        up_write(&o2hb_callback_sem);
-
-       return 0;
 }
 EXPORT_SYMBOL_GPL(o2hb_unregister_callback);
 
diff --git a/fs/ocfs2/cluster/heartbeat.h b/fs/ocfs2/cluster/heartbeat.h
index cac6223..cc6d40b 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,
                         void *data,
                         int priority);
 int o2hb_register_callback(struct o2hb_callback_func *hc);
-int o2hb_unregister_callback(struct o2hb_callback_func *hc);
+void o2hb_unregister_callback(struct o2hb_callback_func *hc);
 void o2hb_fill_node_map(unsigned long *map,
                        unsigned bytes);
 void o2hb_init(void);
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 1718215..69caf3e 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,
 
 void o2net_unregister_hb_callbacks(void)
 {
-       int ret;
-
-       ret = o2hb_unregister_callback(&o2net_hb_up);
-       if (ret < 0)
-               mlog(ML_ERROR, "Status return %d unregistering heartbeat up "
-                    "callback!\n", ret);
-
-       ret = o2hb_unregister_callback(&o2net_hb_down);
-       if (ret < 0)
-               mlog(ML_ERROR, "Status return %d unregistering heartbeat down "
-                    "callback!\n", ret);
+       o2hb_unregister_callback(&o2net_hb_up);
+       o2hb_unregister_callback(&o2net_hb_down);
 }
 
 int o2net_register_hb_callbacks(void)
diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c
index 8fc52d6..b25ef63 100644
--- a/fs/ocfs2/heartbeat.c
+++ b/fs/ocfs2/heartbeat.c
@@ -164,8 +164,10 @@ int ocfs2_register_hb_callbacks(struct ocfs2_super *osb)
        }
 
        status = o2hb_register_callback(&osb->osb_hb_up);
-       if (status < 0)
+       if (status < 0) {
                mlog_errno(status);
+               o2hb_unregister_callback(&osb->osb_hb_down);
+       }
 
 bail:
        return status;
@@ -173,18 +175,11 @@ bail:
 
 void ocfs2_clear_hb_callbacks(struct ocfs2_super *osb)
 {
-       int status;
-
        if (ocfs2_mount_local(osb))
                return;
 
-       status = o2hb_unregister_callback(&osb->osb_hb_down);
-       if (status < 0)
-               mlog_errno(status);
-
-       status = o2hb_unregister_callback(&osb->osb_hb_up);
-       if (status < 0)
-               mlog_errno(status);
+       o2hb_unregister_callback(&osb->osb_hb_down);
+       o2hb_unregister_callback(&osb->osb_hb_up);
 }
 
 void ocfs2_stop_heartbeat(struct ocfs2_super *osb)
-
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