From 73e4e31376b3ce1997dc1756a4989e9411a45847 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 22 Jan 2007 16:44:03 +0000 Subject: [PATCH] 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). --- servers/rs/manager.c | 18 ++++++++++++++++-- servers/rs/manager.h | 2 ++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/servers/rs/manager.c b/servers/rs/manager.c index 1c26d2877..2e0775000 100644 --- a/servers/rs/manager.c +++ b/servers/rs/manager.c @@ -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 */ diff --git a/servers/rs/manager.h b/servers/rs/manager.h index 8f22ab7aa..e1862754d 100644 --- a/servers/rs/manager.h +++ b/servers/rs/manager.h @@ -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 */ -- 2.44.0