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
This commit is contained in:
parent
53640b0e3a
commit
76263c7f1b
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user