]> Zhao Yanbai Git Server - minix.git/commitdiff
RS: refresh service upon init failure 55/355/2
authorThomas Veerman <thomas@minix3.org>
Fri, 22 Feb 2013 13:57:00 +0000 (13:57 +0000)
committerThomas Veerman <thomas@minix3.org>
Fri, 22 Feb 2013 16:06:25 +0000 (16:06 +0000)
When a service fails to initialize, RS exits the service. When injecting
faults this is undesired behavior. With this patch, we're going to assume
that when starting services with the -b flag (no binary exponential
offset), we don't want to exit the service but simply restart the
initialization.

Change-Id: Ie8b9c89e16fe4df8a89ec30ec678a216b4ec5fd0

servers/rs/manager.c

index f05ed3d08d5e1f48d68f351f4fe56601031440fd..266023b4ba00706031d7a054e441392a6b64de6c 100644 (file)
@@ -1002,10 +1002,21 @@ void terminate_service(struct rproc *rp)
 
   /* Deal with failures during initialization. */
   if(rp->r_flags & RS_INITIALIZING) {
-      if(rs_verbose)
-          printf("RS: service '%s' exited during initialization\n",
-              rpub->label);
-      rp->r_flags |= RS_EXITING; /* don't restart. */
+      if (rpub->sys_flags & SF_NO_BIN_EXP) {
+          /* If service was deliberately started with binary exponential offset
+          * disabled, we're going to assume we want to refresh a service upon
+          * failure.
+          */
+          if(rs_verbose)
+              printf("RS: service '%s' exited during initialization; "
+                    "refreshing\n", rpub->label);
+          rp->r_flags |= RS_REFRESHING; /* restart initialization. */
+      } else {
+          if(rs_verbose)
+              printf("RS: service '%s' exited during initialization; "
+                     "not restarting\n", rpub->label);
+          rp->r_flags |= RS_EXITING; /* don't restart. */
+      }
 
       /* If updating, rollback. */
       if(rp->r_flags & RS_UPDATING) {