Don't reply to the caller on RS_DOWN until process is actually dead -

otherwise (e.g.) mounts right after an unmount of the same device don't
work (duplicate label).
This commit is contained in:
Ben Gras 2007-01-22 16:44:03 +00:00
parent f9e4768eb4
commit 73e4e31376
2 changed files with 18 additions and 2 deletions

View File

@ -379,9 +379,14 @@ PUBLIC int do_down(message *m_ptr)
} }
proc = _ENDPOINT_P(rp->r_proc_nr_e); proc = _ENDPOINT_P(rp->r_proc_nr_e);
rproc_ptr[proc] = NULL; 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 #if VERBOSE
printf("do_down: '%s' not found\n", label); printf("do_down: '%s' not found\n", label);
@ -521,13 +526,22 @@ PUBLIC void do_exit(message *m_ptr)
rp->r_pid= -1; rp->r_pid= -1;
if ((rp->r_flags & RS_EXITING) || shutting_down) { 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) if (rp->r_exec)
{ {
free(rp->r_exec); free(rp->r_exec);
rp->r_exec= NULL; rp->r_exec= NULL;
} }
rproc_ptr[proc] = NULL; rproc_ptr[proc] = NULL;
} }
else if(rp->r_flags & RS_REFRESHING) { else if(rp->r_flags & RS_REFRESHING) {
rp->r_restarts = -1; /* reset counter */ rp->r_restarts = -1; /* reset counter */

View File

@ -33,6 +33,7 @@ extern struct rproc {
clock_t r_check_tm; /* timestamp of last check */ clock_t r_check_tm; /* timestamp of last check */
clock_t r_alive_tm; /* timestamp of last heartbeat */ clock_t r_alive_tm; /* timestamp of last heartbeat */
clock_t r_stop_tm; /* timestamp of SIGTERM signal */ clock_t r_stop_tm; /* timestamp of SIGTERM signal */
endpoint_t r_caller; /* RS_LATEREPLY caller */
char *r_exec; /* Executable image */ char *r_exec; /* Executable image */
size_t r_exec_len; /* Length of 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_NOPINGREPLY 0x010 /* driver failed to reply to a ping request */
#define RS_KILLED 0x020 /* driver is killed */ #define RS_KILLED 0x020 /* driver is killed */
#define RS_CRASHED 0x040 /* driver crashed */ #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. */ /* Constants determining RS period and binary exponential backoff. */
#define RS_DELTA_T 60 /* check every T ticks */ #define RS_DELTA_T 60 /* check every T ticks */