• R/O
  • SSH

pm_diskd: Commit

※ リポジトリは、pm-diskd ブランチが https://github.com/linux-ha-japan/pm_diskd-1.0 へ、pm-diskd-2.0ブランチが https://github.com/linux-ha-japan/pm_diskd へ移行しました。

Pacemaker 対応ディスク故障監視機能。

Pacemaker-1.0公式リポジトリのクローンに対し、パッチ作成用のブランチを作成して管理する。
ブランチ名: pm-diskd

初回 hg clone 実行後は、hg update -r pm-diskd を実行すること。

Heartbeat-2.1.4 用 hb-diskd(*) のPacemaker対応版
(*) http://sourceforge.jp/projects/linux-ha/releases/?package_id=10555


Commit MetaInfo

Revisiondd53345f4f38b0dd53c6f48cc70c1218867d34a3 (tree)
Time2012-08-09 06:06:30
Author <hideoyamauchi@inte...>

Log Message

Correction of the error to occur in g_mutex_free_posix_impl.

Change Summary

Incremental Difference

diff -r ec095965fbad -r dd53345f4f38 tools/diskd.c
--- a/tools/diskd.c Wed Apr 11 15:51:18 2012 +0900
+++ b/tools/diskd.c Thu Aug 09 06:06:30 2012 +0900
@@ -104,7 +104,8 @@
104104 static GCond *diskd_cond = NULL; /* Thread Cond */
105105 static gboolean diskd_thread_use = FALSE; /* Tthred Timer Flag */
106106 static GThread *th_timer = NULL; /* Thread Timer */
107-
107+static int timer_id = -1;
108+
108109 static void diskd_thread_timer_init(void);
109110 static void diskd_thread_create(void);
110111 static void diskd_thread_timer_variable_free(gboolean);
@@ -116,6 +117,11 @@
116117 diskd_shutdown(int nsig, gpointer unused)
117118 {
118119 crm_info("Exiting");
120+
121+ if (timer_id != -1) {
122+ Gmain_timeout_remove(timer_id);
123+ timer_id = -1;
124+ }
119125
120126 diskd_thread_condsend();
121127
@@ -265,12 +271,19 @@
265271
266272 static void diskd_thread_condsend()
267273 {
274+ gpointer ret_thread;
268275 if (diskd_thread_use == FALSE) return;
269276
270277 if (diskd_mutex && diskd_cond) {
271278 g_mutex_lock(diskd_mutex);
272279 g_cond_broadcast(diskd_cond);
273280 g_mutex_unlock(diskd_mutex);
281+
282+ if (th_timer != NULL) {
283+ ret_thread = g_thread_join(th_timer);
284+ crm_debug_2("thread_join -> %d", GPOINTER_TO_INT (ret_thread));
285+ th_timer = NULL;
286+ }
274287 } else {
275288 crm_warn("Cannot transmit cond to a thread");
276289 }
@@ -310,14 +323,16 @@
310323 if (diskd_thread_use) {
311324
312325 g_mutex_lock(diskd_mutex);
313-
314- th_timer = g_thread_create ((GThreadFunc)diskd_thread_timer_func, NULL, FALSE, &gerr);
326+
315327 if (th_timer == NULL) {
316- crm_err("Cannot create diskd timer_thread. %s", gerr->message);
317- g_error_free(gerr);
318- diskd_thread_use = FALSE;
328+ th_timer = g_thread_create ((GThreadFunc)diskd_thread_timer_func, NULL, TRUE, &gerr);
329+ if (th_timer == NULL) {
330+ crm_err("Cannot create diskd timer_thread. %s", gerr->message);
331+ g_error_free(gerr);
332+ diskd_thread_use = FALSE;
333+ }
319334 }
320-
335+ sleep(1);
321336 g_mutex_unlock(diskd_mutex);
322337 }
323338 }
@@ -685,7 +700,7 @@
685700 exit(LSB_EXIT_GENERIC);
686701 }
687702 diskcheck_wt(NULL);
688- Gmain_timeout_add(interval*1000, diskcheck_wt, NULL);
703+ timer_id = Gmain_timeout_add(interval*1000, diskcheck_wt, NULL);
689704 } else { /* reader */
690705 pagesize = getpagesize();
691706 ptr = (void *)malloc(2 * pagesize);
@@ -696,7 +711,7 @@
696711 }
697712 buf = (void *)(((u_long)ptr + pagesize) & ~(pagesize-1));
698713 diskcheck(NULL);
699- Gmain_timeout_add(interval*1000, diskcheck, NULL);
714+ timer_id = Gmain_timeout_add(interval*1000, diskcheck, NULL);
700715 }
701716
702717 crm_info("Starting %s", crm_system_name);
Show on old repository browser