From 83a5671405e3914b3dd393cdcb96c3b8de73168b Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Wed, 28 Apr 2010 22:41:06 +0000 Subject: [PATCH] Restart worker thread only if the problem was temporary. In case of persistent problem we don't want to loop forever. MFC after: 3 days --- sbin/hastd/hastd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c index 50bc9ffad819..7b2a8e255d27 100644 --- a/sbin/hastd/hastd.c +++ b/sbin/hastd/hastd.c @@ -140,9 +140,15 @@ child_exit(void) proto_close(res->hr_ctrl); res->hr_workerpid = 0; if (res->hr_role == HAST_ROLE_PRIMARY) { - sleep(1); - pjdlog_info("Restarting worker process."); - hastd_primary(res); + if (WEXITSTATUS(status) == EX_TEMPFAIL) { + sleep(1); + pjdlog_info("Restarting worker process."); + hastd_primary(res); + } else { + res->hr_role = HAST_ROLE_INIT; + pjdlog_info("Changing resource role back to %s.", + role2str(res->hr_role)); + } } pjdlog_prefix_set("%s", ""); }