From: Olaf Kirch <okir@suse.de>
To: nfs@lists.sourceforge.net
Subject: [PATCH 21/22] [lockd] Make statd support switchable
Date: Sat, 5 Aug 2006 15:06:49 +0200 [thread overview]
Message-ID: <20060805130649.GA8123@suse.de> (raw)
From: Olaf Kirch <okir@suse.de>
Subject: [lockd] Make statd support switchable
This patch adds some plumbing that allows to use different
methods for nsm_monitor and nsm_unmonitor.
Signed-off-by: Olaf Kirch <okir@suse.de>
fs/lockd/host.c | 7 +++++++
fs/lockd/mon.c | 17 +++++++++++++++--
fs/lockd/svc.c | 6 ++++++
include/linux/lockd/sm_inter.h | 5 +++--
4 files changed, 31 insertions(+), 4 deletions(-)
Index: build/fs/lockd/host.c
===================================================================
--- build.orig/fs/lockd/host.c
+++ build/fs/lockd/host.c
@@ -32,6 +32,13 @@ static unsigned long next_gc;
static int nrhosts;
static DEFINE_MUTEX(nlm_host_mutex);
+/*
+ * Function pointers - will reference either the
+ * "standard" statd functions that do upcalls to user land,
+ * or the kernel statd functions.
+ */
+int (*nsm_monitor)(struct nlm_host *);
+int (*nsm_unmonitor)(struct nlm_host *);
static void nlm_gc_hosts(void);
static struct nsm_handle * __nsm_find(const struct sockaddr_in *,
Index: build/fs/lockd/mon.c
===================================================================
--- build.orig/fs/lockd/mon.c
+++ build/fs/lockd/mon.c
@@ -18,6 +18,8 @@
#define NLMDBG_FACILITY NLMDBG_MONITOR
static struct rpc_clnt * nsm_create(void);
+static int __nsm_monitor(struct nlm_host *);
+static int __nsm_unmonitor(struct nlm_host *);
static struct rpc_program nsm_program;
@@ -27,6 +29,17 @@ static struct rpc_program nsm_program;
int nsm_local_state;
/*
+ * Initialize lockd for RPC statd upcalls
+ */
+void
+nsm_statd_upcalls_init()
+{
+ nsm_monitor = __nsm_monitor;
+ nsm_unmonitor = __nsm_unmonitor;
+}
+
+
+/*
* Common procedure for SM_MON/SM_UNMON calls
*/
static int
@@ -69,7 +82,7 @@ nsm_mon_unmon(struct nsm_handle *nsm, u3
* Set up monitoring of a remote host
*/
int
-nsm_monitor(struct nlm_host *host)
+__nsm_monitor(struct nlm_host *host)
{
struct nsm_handle *nsm = host->h_nsmhandle;
struct nsm_res res;
@@ -94,7 +107,7 @@ nsm_monitor(struct nlm_host *host)
* Cease to monitor remote host
*/
int
-nsm_unmonitor(struct nlm_host *host)
+__nsm_unmonitor(struct nlm_host *host)
{
struct nsm_handle *nsm = host->h_nsmhandle;
struct nsm_res res;
Index: build/fs/lockd/svc.c
===================================================================
--- build.orig/fs/lockd/svc.c
+++ build/fs/lockd/svc.c
@@ -119,6 +119,9 @@ lockd(struct svc_rqst *rqstp)
daemonize("lockd");
+ /* Initialize the statd upcalls to rpc.statd */
+ nsm_statd_upcalls_init();
+
/* Process request with signals blocked, but allow SIGKILL. */
allow_signal(SIGKILL);
@@ -472,6 +475,9 @@ static int __init init_nlm(void)
{
struct ctl_path ctl_path[] = { { CTL_FS, "fs", 0555 }, { -2, "nfs", 0555 }, { 0 } };
+ /* Default NSM to making upcalls to statd. */
+ nsm_statd_upcalls_init();
+
nlm_sysctl_table = register_sysctl_table_path(nlm_sysctls, ctl_path);
return 0;
}
Index: build/include/linux/lockd/sm_inter.h
===================================================================
--- build.orig/include/linux/lockd/sm_inter.h
+++ build/include/linux/lockd/sm_inter.h
@@ -40,8 +40,9 @@ struct nsm_res {
u32 state;
};
-int nsm_monitor(struct nlm_host *);
-int nsm_unmonitor(struct nlm_host *);
+extern void nsm_statd_upcalls_init(void);
+extern int (*nsm_monitor)(struct nlm_host *);
+extern int (*nsm_unmonitor)(struct nlm_host *);
extern int nsm_local_state;
#endif /* LINUX_LOCKD_SM_INTER_H */
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
reply other threads:[~2006-08-05 13:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060805130649.GA8123@suse.de \
--to=okir@suse.de \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.