unsigned char fl_flags = fl->fl_flags;
int status = -ENOLCK;
- if (!host->h_monitored && nsm_monitor(host) < 0) {
+ if (nsm_monitor(host) < 0) {
printk(KERN_NOTICE "lockd: failed to monitor %s\n",
host->h_name);
goto out;
}
dprintk("lockd: delete host %s\n", host->h_name);
*q = host->h_next;
- /* Don't unmonitor hosts that have been invalidated */
- if (host->h_monitored && !host->h_killed)
- nsm_unmonitor(host);
+
+ /*
+ * Unmonitor unless host was invalidated (i.e. lockd restarted)
+ */
+ nsm_unmonitor(host);
+
if ((clnt = host->h_rpcclnt) != NULL) {
if (atomic_read(&clnt->cl_users)) {
printk(KERN_WARNING
int status;
dprintk("lockd: nsm_monitor(%s)\n", host->h_name);
+ if (host->h_monitored)
+ return 0;
status = nsm_mon_unmon(host, SM_MON, &res);
nsm_unmonitor(struct nlm_host *host)
{
struct nsm_res res;
- int status;
+ int status = 0;
dprintk("lockd: nsm_unmonitor(%s)\n", host->h_name);
-
- status = nsm_mon_unmon(host, SM_UNMON, &res);
- if (status < 0)
- printk(KERN_NOTICE "lockd: cannot unmonitor %s\n", host->h_name);
- else
- host->h_monitored = 0;
+ if (!host->h_monitored)
+ return 0;
+ host->h_monitored = 0;
+
+ if (!host->h_killed) {
+ status = nsm_mon_unmon(host, SM_UNMON, &res);
+ if (status < 0)
+ printk(KERN_NOTICE "lockd: cannot unmonitor %s\n", host->h_name);
+ }
return status;
}
/* Obtain host handle */
if (!(host = nlmsvc_lookup_host(rqstp))
- || (argp->monitor && !host->h_monitored && nsm_monitor(host) < 0))
+ || (argp->monitor && nsm_monitor(host) < 0))
goto no_locks;
*hostp = host;
/* Obtain host handle */
if (!(host = nlmsvc_lookup_host(rqstp))
- || (argp->monitor && !host->h_monitored && nsm_monitor(host) < 0))
+ || (argp->monitor && nsm_monitor(host) < 0))
goto no_locks;
*hostp = host;