FreeBSD/sys/nlm/nlm_prot_impl.c
/*
 * Check for idle hosts and stop monitoring them. We could also free
 * the host structure here, possibly after a larger timeout but that
 * would require some care to avoid races with
 * e.g. nlm_host_lock_count_sysctl.
 */
Check for idle hosts and stop monitoring them. We could also free
the host structure here, possibly after a larger timeout but that
would require some care to avoid races with
e.g.
Check for idle hosts and stop monitoring them . We could also free the host structure here possibly after a larger timeout but that would require some care to avoid races with e . g .
static void
nlm_check_idle(void)
{
	struct nlm_host *host;
	mtx_assert(&nlm_global_lock, MA_OWNED);
	if (time_uptime <= nlm_next_idle_check)
		return;
	nlm_next_idle_check = time_uptime + NLM_IDLE_PERIOD;
	TAILQ_FOREACH(host, &nlm_hosts, nh_link) {
		if (host->nh_monstate == NLM_MONITORED
		    && time_uptime > host->nh_idle_timeout) {
			mtx_unlock(&nlm_global_lock);
			if (lf_countlocks(host->nh_sysid) > 0
			    || lf_countlocks(NLM_SYSID_CLIENT
				+ host->nh_sysid)) {
				host->nh_idle_timeout =
					time_uptime + NLM_IDLE_TIMEOUT;
				mtx_lock(&nlm_global_lock);
				continue;
			}
			nlm_host_unmonitor(host);
			mtx_lock(&nlm_global_lock);
		} 
	}
}
static void nlm_check_idle ( void ) { struct nlm_host * host ; mtx_assert ( & nlm_global_lock , MA_OWNED ) ; if ( time_uptime <= nlm_next_idle_check ) return ; nlm_next_idle_check = time_uptime + NLM_IDLE_PERIOD ; TAILQ_FOREACH ( host , & nlm_hosts , nh_link ) { if ( host -> nh_monstate == NLM_MONITORED && time_uptime > host -> nh_idle_timeout ) { mtx_unlock ( & nlm_global_lock ) ; if ( lf_countlocks ( host -> nh_sysid ) > 0 || lf_countlocks ( NLM_SYSID_CLIENT + host -> nh_sysid ) ) { host -> nh_idle_timeout = time_uptime + NLM_IDLE_TIMEOUT ; mtx_lock ( & nlm_global_lock ) ; continue ; } nlm_host_unmonitor ( host ) ; mtx_lock ( & nlm_global_lock ) ; } } }
Check for idle hosts and stop monitoring them.
Check for idle hosts and stop monitoring them .