RS: clean up dead services during shutdown

Previously, RS would clean up dead services only when it is idle.
During shutdown, all services are marked with the 'exiting' flag,
and these flags lead RS to conclude it is not idle.  Therefore, at
shutdown time, no services were cleaned up anymore, leading to
deadlock situations.  For example, VFS could end up waiting for a
service that was already dead, or one driver could end up waiting
for an interrupt on a line shared with another dead driver.

While it may be possible to ignore RS_EXITING when checking idle
status, other flags may have the same ultimate effect.  Therefore,
this patch skips the idle check altogether when in shutdown mode.

Change-Id: I071fa9545da1d43c5e5c2e0bc2b6c173e3bb57c3
This commit is contained in:
David van Moolenbroek 2015-09-05 08:01:33 +02:00
parent 1aa4eb6a85
commit e3f3566e33

View file

@ -421,7 +421,10 @@ void rs_idle_period()
int r;
/* Not much to do when RS is not idle. */
if(!rs_is_idle()) {
/* However, to avoid deadlocks it is absolutely necessary that during system
* shutdown, dead services are actually cleaned up. Override the idle check.
*/
if(!shutting_down && !rs_is_idle()) {
return;
}
@ -432,6 +435,8 @@ void rs_idle_period()
}
}
if (shutting_down) return;
/* Create missing replicas when necessary. */
for (rp=BEG_RPROC_ADDR; rp<END_RPROC_ADDR; rp++) {
rpub = rp->r_pub;