diff options
author | dfr <dfr@FreeBSD.org> | 2008-06-02 15:59:10 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2008-06-02 15:59:10 +0000 |
commit | dc4eba5b744c3dbb56a2c2586eebae38bcf54590 (patch) | |
tree | 1992bf3642dc0bb13e3fcb9746a82b3f8caf39cb /sys/nlm | |
parent | 96dd177bf086cc3c1d60be0d092aa3bc06f7df20 (diff) | |
download | FreeBSD-src-dc4eba5b744c3dbb56a2c2586eebae38bcf54590.zip FreeBSD-src-dc4eba5b744c3dbb56a2c2586eebae38bcf54590.tar.gz |
When attempting to use the NSM state number in a lock request to detect
a client reboot, do this check before performing the lock otherwise we
will trash the new lock along with any other old locks the client held
before rebooting.
Make sure nlm_check_idle always returns with nlm_global_lock held.
MFC after: 1 week
Diffstat (limited to 'sys/nlm')
-rw-r--r-- | sys/nlm/nlm_prot_impl.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/nlm/nlm_prot_impl.c b/sys/nlm/nlm_prot_impl.c index 8c00665..eeea4c7 100644 --- a/sys/nlm/nlm_prot_impl.c +++ b/sys/nlm/nlm_prot_impl.c @@ -694,6 +694,7 @@ nlm_check_idle(void) if (lf_countlocks(host->nh_sysid) > 0) { host->nh_idle_timeout = time_uptime + NLM_IDLE_TIMEOUT; + mtx_lock(&nlm_global_lock); continue; } nlm_host_unmonitor(host); @@ -886,14 +887,6 @@ nlm_host_monitor(struct nlm_host *host, int state) struct timeval timo; enum clnt_stat stat; - if (host->nh_state && state && host->nh_state != state) { - /* - * The host rebooted without telling us. Trash its - * locks. - */ - nlm_host_notify(host, state, FALSE); - } - if (state && !host->nh_state) { /* * This is the first time we have seen an NSM state @@ -1492,6 +1485,15 @@ nlm_do_lock(nlm4_lockargs *argp, nlm4_res *result, struct svc_req *rqstp, printf("nlm_do_lock(): caller_name = %s (sysid = %d)\n", host->nh_caller_name, host->nh_sysid); + if (monitor && host->nh_state && argp->state + && host->nh_state != argp->state) { + /* + * The host rebooted without telling us. Trash its + * locks. + */ + nlm_host_notify(host, argp->state, FALSE); + } + nlm_free_finished_locks(host); sysid = host->nh_sysid; |