]> Zhao Yanbai Git Server - minix.git/commitdiff
Don't reply to the caller on RS_DOWN until process is actually dead -
authorBen Gras <ben@minix3.org>
Mon, 22 Jan 2007 16:44:03 +0000 (16:44 +0000)
committerBen Gras <ben@minix3.org>
Mon, 22 Jan 2007 16:44:03 +0000 (16:44 +0000)
otherwise (e.g.) mounts right after an unmount of the same device don't
work (duplicate label).

servers/rs/manager.c
servers/rs/manager.h

index 1c26d2877a607c1957d60ac2cf414b97fb982c8b..2e0775000ed2ec5ef5abaa5e0fbd5669ac148960 100644 (file)
@@ -379,8 +379,13 @@ PUBLIC int do_down(message *m_ptr)
                }
                proc = _ENDPOINT_P(rp->r_proc_nr_e);
                rproc_ptr[proc] = NULL;
+               return(OK);
          }
-         return(OK);
+
+         /* Late reply - send a reply when process dies. */
+         rp->r_flags |= RS_LATEREPLY;
+         rp->r_caller = m_ptr->m_source;
+         return EDONTREPLY;
       }
   }
 #if VERBOSE
@@ -521,13 +526,22 @@ PUBLIC void do_exit(message *m_ptr)
              rp->r_pid= -1;
 
               if ((rp->r_flags & RS_EXITING) || shutting_down) {
-                 rp->r_flags = 0;                      /* release slot */
+                 /* No reply sent to RS_DOWN yet. */
+                 if(rp->r_flags & RS_LATEREPLY) {
+                       message rsm;
+                       rsm.m_type = OK;
+                       send(rp->r_caller, &rsm);
+                 }
+
+                 /* Release slot. */
+                 rp->r_flags = 0;
                  if (rp->r_exec)
                  {
                        free(rp->r_exec);
                        rp->r_exec= NULL;
                  }
                  rproc_ptr[proc] = NULL;
+
              }
              else if(rp->r_flags & RS_REFRESHING) {
                      rp->r_restarts = -1;              /* reset counter */
index 8f22ab7aac0ac546216f9c1ec30dfc8d4686c835..e1862754d7f2902d23c366325c69d3657b9e8acc 100644 (file)
@@ -33,6 +33,7 @@ extern struct rproc {
   clock_t r_check_tm;          /* timestamp of last check */
   clock_t r_alive_tm;          /* timestamp of last heartbeat */
   clock_t r_stop_tm;           /* timestamp of SIGTERM signal */
+  endpoint_t r_caller;         /* RS_LATEREPLY caller */
 
   char *r_exec;                        /* Executable image */ 
   size_t r_exec_len;           /* Length of image */
@@ -68,6 +69,7 @@ extern struct rproc *rproc_ptr[NR_PROCS];
 #define RS_NOPINGREPLY         0x010   /* driver failed to reply to a ping request */
 #define RS_KILLED      0x020   /* driver is killed */
 #define RS_CRASHED     0x040   /* driver crashed */
+#define RS_LATEREPLY   0x080   /* no reply sent to RS_DOWN caller yet */
 
 /* Constants determining RS period and binary exponential backoff. */
 #define RS_DELTA_T       60                    /* check every T ticks */