summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/lockd/mon.c16
-rw-r--r--include/linux/lockd/lockd.h1
-rw-r--r--include/linux/lockd/sm_inter.h1
-rw-r--r--include/linux/lockd/xdr.h6
4 files changed, 23 insertions, 1 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 0792900b628..c8d18cd22b8 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -201,6 +201,21 @@ void nsm_unmonitor(const struct nlm_host *host)
}
}
+/*
+ * Construct a unique cookie to match this nsm_handle to this monitored
+ * host. It is passed to the local rpc.statd via NSMPROC_MON, and
+ * returned via NLMPROC_SM_NOTIFY, in the "priv" field of these
+ * requests.
+ *
+ * Linux provides the raw IP address of the monitored host,
+ * left in network byte order.
+ */
+static void nsm_init_private(struct nsm_handle *nsm)
+{
+ __be32 *p = (__be32 *)&nsm->sm_priv.data;
+ *p = nsm_addr_in(nsm)->sin_addr.s_addr;
+}
+
/**
* nsm_find - Find or create a cached nsm_handle
* @sap: pointer to socket address of handle to find
@@ -271,6 +286,7 @@ retry:
nsm->sm_name = (char *) (nsm + 1);
memcpy(nsm->sm_name, hostname, hostname_len);
nsm->sm_name[hostname_len] = '\0';
+ nsm_init_private(nsm);
nsm_display_address((struct sockaddr *)&nsm->sm_addr,
nsm->sm_addrbuf, sizeof(nsm->sm_addrbuf));
atomic_set(&nsm->sm_count, 1);
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 8d715363c6a..194fa8a6639 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -85,6 +85,7 @@ struct nsm_handle {
size_t sm_addrlen;
unsigned int sm_monitored : 1,
sm_sticky : 1; /* don't unmonitor */
+ struct nsm_private sm_priv;
char sm_addrbuf[NSM_ADDRBUF];
};
diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h
index 116bf38535a..5cef5a79dd9 100644
--- a/include/linux/lockd/sm_inter.h
+++ b/include/linux/lockd/sm_inter.h
@@ -10,7 +10,6 @@
#define LINUX_LOCKD_SM_INTER_H
#define SM_MAXSTRLEN 1024
-#define SM_PRIV_SIZE 16
extern int nsm_local_state;
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index d6b3a802c04..6b519926385 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -13,6 +13,12 @@
#include <linux/nfs.h>
#include <linux/sunrpc/xdr.h>
+#define SM_PRIV_SIZE 16
+
+struct nsm_private {
+ unsigned char data[SM_PRIV_SIZE];
+};
+
struct svc_rqst;
#define NLM_MAXCOOKIELEN 32