summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2002-09-12 01:39:40 -0700
committerDavid S. Miller <davem@nuts.ninka.net>2002-09-12 01:39:40 -0700
commitf96e7cb1d1e2b1e40dc38d71cfcdf1a7ac606944 (patch)
treebb8a5b67aea7ccc01a5ed28cf876679bac5c30ee
parent0ec2ca3880caee8d795a9e4429801eebb744c4f8 (diff)
[PATCH] kNFSd 2: Lockd to shutdown without engaging with nfsd
Currently, when lockd wants to invalidate all it's clients, it asks nfsd to iterate through them. Now it iterates itself.
-rw-r--r--fs/lockd/host.c24
-rw-r--r--fs/lockd/svc.c4
-rw-r--r--fs/lockd/svcsubs.c15
-rw-r--r--fs/nfsd/export.c12
-rw-r--r--fs/nfsd/lockd.c1
-rw-r--r--include/linux/lockd/bind.h1
-rw-r--r--include/linux/lockd/lockd.h3
-rw-r--r--include/linux/nfsd/export.h1
8 files changed, 44 insertions, 17 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index bf42dd94a6f8..7d714b7943be 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -159,6 +159,30 @@ nohost:
return host;
}
+struct nlm_host *
+nlm_find_client(void)
+{
+ /* find a nlm_host for a client for which h_killed == 0.
+ * and return it
+ */
+ int hash;
+ down(&nlm_host_sema);
+ for (hash = 0 ; hash < NLM_HOST_NRHASH; hash++) {
+ struct nlm_host *host, **hp;
+ for (hp = &nlm_hosts[hash]; (host = *hp) ; hp = &host->h_next) {
+ if (host->h_exportent != NULL &&
+ host->h_killed == 0) {
+ nlm_get_host(host);
+ up(&nlm_host_sema);
+ return host;
+ }
+ }
+ }
+ up(&nlm_host_sema);
+ return NULL;
+}
+
+
/*
* Create the NLM RPC client for an NLM peer
*/
diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index a31980b124b1..ad342eb1ff22 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -130,7 +130,7 @@ lockd(struct svc_rqst *rqstp)
flush_signals(current);
spin_unlock_irq(&current->sigmask_lock);
if (nlmsvc_ops) {
- nlmsvc_ops->detach();
+ nlmsvc_invalidate_all();
grace_period_expire = set_grace_period();
}
}
@@ -187,7 +187,7 @@ lockd(struct svc_rqst *rqstp)
*/
if (!nlmsvc_pid || current->pid == nlmsvc_pid) {
if (nlmsvc_ops)
- nlmsvc_ops->detach();
+ nlmsvc_invalidate_all();
nlm_shutdown_hosts();
nlmsvc_pid = 0;
} else
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 4ebc83ea4f92..6c6d52453a2d 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -309,3 +309,18 @@ nlmsvc_invalidate_client(struct svc_client *clnt)
nlm_release_host(host);
}
}
+
+/*
+ * delete all hosts structs for clients
+ */
+void
+nlmsvc_invalidate_all(void)
+{
+ struct nlm_host *host;
+ while ((host = nlm_find_client()) != NULL) {
+ nlmsvc_free_host_resources(host);
+ host->h_expires = 0;
+ host->h_killed = 1;
+ nlm_release_host(host);
+ }
+}
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index aa7577b3a203..43adb434ea3c 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -878,18 +878,6 @@ again:
}
/*
- * Lockd is shutting down and tells us to unregister all clients
- */
-void
-exp_nlmdetach(void)
-{
- struct svc_client *clp;
-
- for (clp = clients; clp; clp = clp->cl_next)
- nfsd_lockd_unexport(clp);
-}
-
-/*
* Verify that string is non-empty and does not exceed max length.
*/
static int
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
index 80976cf922b7..5c21dd94f6ec 100644
--- a/fs/nfsd/lockd.c
+++ b/fs/nfsd/lockd.c
@@ -66,7 +66,6 @@ struct nlmsvc_binding nfsd_nlm_ops = {
.exp_getclient = exp_getclient, /* look up NFS client */
.fopen = nlm_fopen, /* open file for locking */
.fclose = nlm_fclose, /* close file */
- .detach = exp_nlmdetach, /* lockd shutdown notification */
};
/*
diff --git a/include/linux/lockd/bind.h b/include/linux/lockd/bind.h
index 40dd93194089..e40554349b2a 100644
--- a/include/linux/lockd/bind.h
+++ b/include/linux/lockd/bind.h
@@ -26,7 +26,6 @@ struct nlmsvc_binding {
struct nfs_fh *,
struct file *);
void (*fclose)(struct file *);
- void (*detach)(void);
};
extern struct nlmsvc_binding * nlmsvc_ops;
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index caa826a929e4..dbf013c3d890 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -150,6 +150,8 @@ void nlm_rebind_host(struct nlm_host *);
struct nlm_host * nlm_get_host(struct nlm_host *);
void nlm_release_host(struct nlm_host *);
void nlm_shutdown_hosts(void);
+extern struct nlm_host *nlm_find_client(void);
+
/*
* Server-side lock handling
@@ -173,6 +175,7 @@ u32 nlm_lookup_file(struct svc_rqst *, struct nlm_file **,
void nlm_release_file(struct nlm_file *);
void nlmsvc_mark_resources(void);
void nlmsvc_free_host_resources(struct nlm_host *);
+void nlmsvc_invalidate_all(void);
static __inline__ struct inode *
nlmsvc_file_inode(struct nlm_file *file)
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 9de10bf92e32..a5c23140778b 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -102,7 +102,6 @@ struct svc_export * exp_get_by_name(struct svc_client *clp,
int exp_rootfh(struct svc_client *,
char *path, struct knfsd_fh *, int maxsize);
int nfserrno(int errno);
-void exp_nlmdetach(void);
#endif /* __KERNEL__ */