diff options
author | pjd <pjd@FreeBSD.org> | 2010-04-28 22:41:06 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2010-04-28 22:41:06 +0000 |
commit | b9745c56c32f05ef97dad10290a195b6c8bbeaa1 (patch) | |
tree | f0746dd7da247396447882d90aea1f260a34a828 /sbin/hastd | |
parent | 0b8041abddf4130f04938e6ee94d4b703d62cea5 (diff) | |
download | FreeBSD-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.c | 12 |
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", ""); } |