summaryrefslogtreecommitdiffstats
path: root/sbin/hastd
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2010-04-28 22:41:06 +0000
committerpjd <pjd@FreeBSD.org>2010-04-28 22:41:06 +0000
commitb9745c56c32f05ef97dad10290a195b6c8bbeaa1 (patch)
treef0746dd7da247396447882d90aea1f260a34a828 /sbin/hastd
parent0b8041abddf4130f04938e6ee94d4b703d62cea5 (diff)
downloadFreeBSD-src-b9745c56c32f05ef97dad10290a195b6c8bbeaa1.zip
FreeBSD-src-b9745c56c32f05ef97dad10290a195b6c8bbeaa1.tar.gz
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
Diffstat (limited to 'sbin/hastd')
-rw-r--r--sbin/hastd/hastd.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c
index 50bc9ff..7b2a8e2 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", "");
}
OpenPOWER on IntegriCloud