From: David van Moolenbroek Date: Sat, 5 Sep 2015 06:01:33 +0000 (+0200) Subject: RS: clean up dead services during shutdown X-Git-Url: http://zhaoyanbai.com/repos/pkcs11-tokens.html?a=commitdiff_plain;h=e3f3566e337a8e42174b9d9f00f053206af94db2;p=minix.git 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 --- diff --git a/minix/servers/rs/utility.c b/minix/servers/rs/utility.c index 5810f25cc..02a4ccbfd 100644 --- a/minix/servers/rs/utility.c +++ b/minix/servers/rs/utility.c @@ -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; rpr_pub;