Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Apr 2010 22:41:06 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r207348 - head/sbin/hastd
Message-ID:  <201004282241.o3SMf6Ao089781@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Wed Apr 28 22:41:06 2010
New Revision: 207348
URL: http://svn.freebsd.org/changeset/base/207348

Log:
  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

Modified:
  head/sbin/hastd/hastd.c

Modified: head/sbin/hastd/hastd.c
==============================================================================
--- head/sbin/hastd/hastd.c	Wed Apr 28 22:39:47 2010	(r207347)
+++ head/sbin/hastd/hastd.c	Wed Apr 28 22:41:06 2010	(r207348)
@@ -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", "");
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004282241.o3SMf6Ao089781>