diff -u --recursive --new-file linux-2.4.10-locks/fs/lockd/clntlock.c linux-2.4.10-reclaim/fs/lockd/clntlock.c --- linux-2.4.10-locks/fs/lockd/clntlock.c Sat Sep 22 15:42:00 2001 +++ linux-2.4.10-reclaim/fs/lockd/clntlock.c Sat Sep 22 15:52:52 2001 @@ -138,7 +138,7 @@ void nlmclnt_recovery(struct nlm_host *host, u32 newstate) { - if (!host->h_reclaiming++) { + if (host->h_reclaiming++) { if (host->h_nsmstate == newstate) return; printk(KERN_WARNING @@ -153,7 +153,7 @@ host->h_nsmstate = newstate; host->h_state++; nlm_get_host(host); - kernel_thread(reclaimer, host, 0); + kernel_thread(reclaimer, host, CLONE_SIGNAL); } } @@ -164,11 +164,12 @@ struct nlm_wait *block; struct list_head *tmp; + daemonize(); reparent_to_init(); snprintf(current->comm, sizeof(current->comm), "%s-reclaim", host->h_name); - + /* This one ensures that our parent doesn't terminate while the * reclaim is in progress */ lock_kernel(); @@ -177,7 +178,7 @@ /* First, reclaim all locks that have been granted previously. */ restart: tmp = file_lock_list.next; - while (tmp != &file_lock_list) { + while (tmp != &file_lock_list && ! signalled()) { struct file_lock *fl = list_entry(tmp, struct file_lock, fl_link); struct inode *inode = fl->fl_file->f_dentry->d_inode; if (inode->i_sb->s_magic == NFS_SUPER_MAGIC && diff -u --recursive --new-file linux-2.4.10-locks/fs/lockd/host.c linux-2.4.10-reclaim/fs/lockd/host.c --- linux-2.4.10-locks/fs/lockd/host.c Fri Feb 9 20:29:44 2001 +++ linux-2.4.10-reclaim/fs/lockd/host.c Sat Sep 22 15:52:52 2001 @@ -51,7 +51,8 @@ struct nlm_host * nlmsvc_lookup_host(struct svc_rqst *rqstp) { - return nlm_lookup_host(rqstp->rq_client, &rqstp->rq_addr, 0, 0); + return nlm_lookup_host(rqstp->rq_client, &rqstp->rq_addr, + rqstp->rq_prot, rqstp->rq_vers); } /* @@ -97,7 +98,9 @@ nlm_gc_hosts(); for (hp = &nlm_hosts[hash]; (host = *hp); hp = &host->h_next) { - if (host->h_version != version || host->h_proto != proto) + if (proto && host->h_proto != proto) + continue; + if (version && host->h_version != version) continue; if (nlm_match_host(host, clnt, sin)) { diff -u --recursive --new-file linux-2.4.10-locks/fs/lockd/mon.c linux-2.4.10-reclaim/fs/lockd/mon.c --- linux-2.4.10-locks/fs/lockd/mon.c Tue Jun 12 04:15:27 2001 +++ linux-2.4.10-reclaim/fs/lockd/mon.c Sat Sep 22 15:52:52 2001 @@ -43,7 +43,7 @@ args.addr = host->h_addr.sin_addr.s_addr; args.prog = NLM_PROGRAM; - args.vers = 1; + args.vers = host->h_version; args.proc = NLMPROC_NSM_NOTIFY; memset(res, 0, sizeof(*res)); diff -u --recursive --new-file linux-2.4.10-locks/fs/lockd/svc.c linux-2.4.10-reclaim/fs/lockd/svc.c --- linux-2.4.10-locks/fs/lockd/svc.c Sat Sep 22 15:42:00 2001 +++ linux-2.4.10-reclaim/fs/lockd/svc.c Sun Sep 23 11:42:35 2001 @@ -84,7 +84,7 @@ spin_lock_irq(¤t->sigmask_lock); siginitsetinv(¤t->blocked, sigmask(SIGKILL)); recalc_sigpending(current); - spin_unlock_irq(¤t->sigmask_lock); + spin_unlock_irq(¤t->sigmask_lock); /* kick rpciod */ rpciod_up(); @@ -97,12 +97,11 @@ #ifdef RPC_DEBUG nlmsvc_grace_period = 10 * HZ; #else - if (nlm_grace_period) { - nlmsvc_grace_period += (1 + nlm_grace_period / nlm_timeout) - * nlm_timeout * HZ; - } else { - nlmsvc_grace_period += 5 * nlm_timeout * HZ; - } + if (nlm_grace_period) + nlmsvc_grace_period = ((nlm_grace_period + nlm_timeout - 1) + / nlm_timeout) * nlm_timeout * HZ; + else + nlmsvc_grace_period = 5 * nlm_timeout * HZ; #endif grace_period_expire = nlmsvc_grace_period + jiffies; @@ -122,12 +121,6 @@ spin_unlock_irq(¤t->sigmask_lock); if (nlmsvc_ops) { nlmsvc_ops->detach(); -#ifdef RPC_DEBUG - nlmsvc_grace_period = 10 * HZ; -#else - nlmsvc_grace_period += 5 * nlm_timeout * HZ; - -#endif grace_period_expire = nlmsvc_grace_period + jiffies; } } @@ -138,18 +131,17 @@ * (Theoretically, there shouldn't even be blocked locks * during grace period). */ - if (!nlmsvc_grace_period) { + if (!grace_period_expire) { timeout = nlmsvc_retry_blocked(); - } else if (time_before(nlmsvc_grace_period, jiffies)) - nlmsvc_grace_period = 0; + } else if (time_before(grace_period_expire, jiffies)) + grace_period_expire = 0; /* * Find a socket with data available and call its * recvfrom routine. */ - if ((err = svc_recv(serv, rqstp, timeout)) == -EAGAIN - || err == -EINTR - ) + err = svc_recv(serv, rqstp, timeout); + if (err == -EAGAIN || err == -EINTR) continue; if (err < 0) { printk(KERN_WARNING @@ -345,7 +337,7 @@ * Define NLM program and procedures */ static struct svc_version nlmsvc_version1 = { - 1, 16, nlmsvc_procedures, NULL + 1, 17, nlmsvc_procedures, NULL }; static struct svc_version nlmsvc_version3 = { 3, 24, nlmsvc_procedures, NULL diff -u --recursive --new-file linux-2.4.10-locks/fs/lockd/svc4proc.c linux-2.4.10-reclaim/fs/lockd/svc4proc.c --- linux-2.4.10-locks/fs/lockd/svc4proc.c Fri Feb 9 20:29:44 2001 +++ linux-2.4.10-reclaim/fs/lockd/svc4proc.c Sat Sep 22 15:52:52 2001 @@ -420,6 +420,8 @@ void *resp) { struct sockaddr_in saddr = rqstp->rq_addr; + int vers = rqstp->rq_vers; + int prot = rqstp->rq_prot; struct nlm_host *host; dprintk("lockd: SM_NOTIFY called\n"); @@ -435,8 +437,8 @@ /* Obtain the host pointer for this NFS server and try to * reclaim all locks we hold on this server. */ - saddr.sin_addr.s_addr = argp->addr; - if ((host = nlm_lookup_host(NULL, &saddr, IPPROTO_UDP, 1)) != NULL) { + saddr.sin_addr.s_addr = htonl(argp->addr); + if ((host = nlmclnt_lookup_host(&saddr, prot, vers)) != NULL) { nlmclnt_recovery(host, argp->state); nlm_release_host(host); } @@ -444,7 +446,7 @@ /* If we run on an NFS server, delete all locks held by the client */ if (nlmsvc_ops != NULL) { struct svc_client *clnt; - saddr.sin_addr.s_addr = argp->addr; + saddr.sin_addr.s_addr = argp->addr; if ((clnt = nlmsvc_ops->exp_getclient(&saddr)) != NULL && (host = nlm_lookup_host(clnt, &saddr, 0, 0)) != NULL) { nlmsvc_free_host_resources(host); @@ -549,7 +551,8 @@ PROC(cancel_res, cancelres, norep, res, void), PROC(unlock_res, unlockres, norep, res, void), PROC(granted_res, grantedres, norep, res, void), - PROC(none, void, void, void, void), + /* statd callback */ + PROC(sm_notify, reboot, void, reboot, void), PROC(none, void, void, void, void), PROC(none, void, void, void, void), PROC(none, void, void, void, void), @@ -558,6 +561,4 @@ PROC(nm_lock, lockargs, res, args, res), PROC(free_all, notify, void, args, void), - /* statd callback */ - PROC(sm_notify, reboot, void, reboot, void), }; diff -u --recursive --new-file linux-2.4.10-locks/fs/lockd/svcproc.c linux-2.4.10-reclaim/fs/lockd/svcproc.c --- linux-2.4.10-locks/fs/lockd/svcproc.c Fri Feb 9 20:29:44 2001 +++ linux-2.4.10-reclaim/fs/lockd/svcproc.c Sat Sep 22 15:52:52 2001 @@ -445,6 +445,8 @@ void *resp) { struct sockaddr_in saddr = rqstp->rq_addr; + int vers = rqstp->rq_vers; + int prot = rqstp->rq_prot; struct nlm_host *host; dprintk("lockd: SM_NOTIFY called\n"); @@ -460,8 +462,8 @@ /* Obtain the host pointer for this NFS server and try to * reclaim all locks we hold on this server. */ - saddr.sin_addr.s_addr = argp->addr; - if ((host = nlm_lookup_host(NULL, &saddr, IPPROTO_UDP, 1)) != NULL) { + saddr.sin_addr.s_addr = htonl(argp->addr); + if ((host = nlmclnt_lookup_host(&saddr, prot, vers)) != NULL) { nlmclnt_recovery(host, argp->state); nlm_release_host(host); } @@ -574,7 +576,8 @@ PROC(cancel_res, cancelres, norep, res, void), PROC(unlock_res, unlockres, norep, res, void), PROC(granted_res, grantedres, norep, res, void), - PROC(none, void, void, void, void), + /* statd callback */ + PROC(sm_notify, reboot, void, reboot, void), PROC(none, void, void, void, void), PROC(none, void, void, void, void), PROC(none, void, void, void, void), @@ -583,6 +586,4 @@ PROC(nm_lock, lockargs, res, args, res), PROC(free_all, notify, void, args, void), - /* statd callback */ - PROC(sm_notify, reboot, void, reboot, void), }; diff -u --recursive --new-file linux-2.4.10-locks/include/linux/lockd/nlm.h linux-2.4.10-reclaim/include/linux/lockd/nlm.h --- linux-2.4.10-locks/include/linux/lockd/nlm.h Mon Aug 13 21:28:01 2001 +++ linux-2.4.10-reclaim/include/linux/lockd/nlm.h Sat Sep 22 16:11:01 2001 @@ -49,10 +49,10 @@ #define NLMPROC_CANCEL_RES 13 #define NLMPROC_UNLOCK_RES 14 #define NLMPROC_GRANTED_RES 15 +#define NLMPROC_NSM_NOTIFY 16 /* statd callback */ #define NLMPROC_SHARE 20 #define NLMPROC_UNSHARE 21 #define NLMPROC_NM_LOCK 22 #define NLMPROC_FREE_ALL 23 -#define NLMPROC_NSM_NOTIFY 24 /* statd callback */ #endif /* LINUX_LOCKD_NLM_H */