]> Pileus Git - ~andy/linux/blobdiff - fs/ocfs2/heartbeat.c
usermodehelper: Tidy up waiting
[~andy/linux] / fs / ocfs2 / heartbeat.c
index cbfd45a97a636f445246fa9c885b6b9e330269ec..c4c36171240d0555d5db10d0edb341c2a52627c9 100644 (file)
@@ -154,15 +154,20 @@ int ocfs2_register_hb_callbacks(struct ocfs2_super *osb)
 {
        int status;
 
-       status = o2hb_register_callback(&osb->osb_hb_down);
+       if (ocfs2_mount_local(osb))
+               return 0;
+
+       status = o2hb_register_callback(osb->uuid_str, &osb->osb_hb_down);
        if (status < 0) {
                mlog_errno(status);
                goto bail;
        }
 
-       status = o2hb_register_callback(&osb->osb_hb_up);
-       if (status < 0)
+       status = o2hb_register_callback(osb->uuid_str, &osb->osb_hb_up);
+       if (status < 0) {
                mlog_errno(status);
+               o2hb_unregister_callback(osb->uuid_str, &osb->osb_hb_down);
+       }
 
 bail:
        return status;
@@ -170,15 +175,11 @@ bail:
 
 void ocfs2_clear_hb_callbacks(struct ocfs2_super *osb)
 {
-       int status;
-
-       status = o2hb_unregister_callback(&osb->osb_hb_down);
-       if (status < 0)
-               mlog_errno(status);
+       if (ocfs2_mount_local(osb))
+               return;
 
-       status = o2hb_unregister_callback(&osb->osb_hb_up);
-       if (status < 0)
-               mlog_errno(status);
+       o2hb_unregister_callback(osb->uuid_str, &osb->osb_hb_down);
+       o2hb_unregister_callback(osb->uuid_str, &osb->osb_hb_up);
 }
 
 void ocfs2_stop_heartbeat(struct ocfs2_super *osb)
@@ -186,6 +187,9 @@ void ocfs2_stop_heartbeat(struct ocfs2_super *osb)
        int ret;
        char *argv[5], *envp[3];
 
+       if (ocfs2_mount_local(osb))
+               return;
+
        if (!osb->uuid_str) {
                /* This can happen if we don't get far enough in mount... */
                mlog(0, "No UUID with which to stop heartbeat!\n\n");
@@ -205,7 +209,7 @@ void ocfs2_stop_heartbeat(struct ocfs2_super *osb)
        envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
        envp[2] = NULL;
 
-       ret = call_usermodehelper(argv[0], argv, envp, 1);
+       ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC);
        if (ret < 0)
                mlog_errno(ret);
 }