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
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;
}
}
}
+ if (shutting_down) return;
+
/* Create missing replicas when necessary. */
for (rp=BEG_RPROC_ADDR; rp<END_RPROC_ADDR; rp++) {
rpub = rp->r_pub;