aboutsummaryrefslogtreecommitdiffstats
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 0792900b6281..c8d18cd22b8a 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -201,6 +201,21 @@ void nsm_unmonitor(const struct nlm_host *host)
201 } 201 }
202} 202}
203 203
204/*
205 * Construct a unique cookie to match this nsm_handle to this monitored
206 * host. It is passed to the local rpc.statd via NSMPROC_MON, and
207 * returned via NLMPROC_SM_NOTIFY, in the "priv" field of these
208 * requests.
209 *
210 * Linux provides the raw IP address of the monitored host,
211 * left in network byte order.
212 */
213static void nsm_init_private(struct nsm_handle *nsm)
214{
215 __be32 *p = (__be32 *)&nsm->sm_priv.data;
216 *p = nsm_addr_in(nsm)->sin_addr.s_addr;
217}
218
204/** 219/**
205 * nsm_find - Find or create a cached nsm_handle 220 * nsm_find - Find or create a cached nsm_handle
206 * @sap: pointer to socket address of handle to find 221 * @sap: pointer to socket address of handle to find
@@ -271,6 +286,7 @@ retry:
271 nsm->sm_name = (char *) (nsm + 1); 286 nsm->sm_name = (char *) (nsm + 1);
272 memcpy(nsm->sm_name, hostname, hostname_len); 287 memcpy(nsm->sm_name, hostname, hostname_len);
273 nsm->sm_name[hostname_len] = '\0'; 288 nsm->sm_name[hostname_len] = '\0';
289 nsm_init_private(nsm);
274 nsm_display_address((struct sockaddr *)&nsm->sm_addr, 290 nsm_display_address((struct sockaddr *)&nsm->sm_addr,
275 nsm->sm_addrbuf, sizeof(nsm->sm_addrbuf)); 291 nsm->sm_addrbuf, sizeof(nsm->sm_addrbuf));
276 atomic_set(&nsm->sm_count, 1); 292 atomic_set(&nsm->sm_count, 1);
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 8d715363c6ac..194fa8a66398 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -85,6 +85,7 @@ struct nsm_handle {
85 size_t sm_addrlen; 85 size_t sm_addrlen;
86 unsigned int sm_monitored : 1, 86 unsigned int sm_monitored : 1,
87 sm_sticky : 1; /* don't unmonitor */ 87 sm_sticky : 1; /* don't unmonitor */
88 struct nsm_private sm_priv;
88 char sm_addrbuf[NSM_ADDRBUF]; 89 char sm_addrbuf[NSM_ADDRBUF];
89}; 90};
90 91
diff --git a/include/linux/lockd/sm_inter.h b/include/linux/lockd/sm_inter.h
index 116bf38535a0..5cef5a79dd94 100644
--- a/include/linux/lockd/sm_inter.h
+++ b/include/linux/lockd/sm_inter.h
@@ -10,7 +10,6 @@
10#define LINUX_LOCKD_SM_INTER_H 10#define LINUX_LOCKD_SM_INTER_H
11 11
12#define SM_MAXSTRLEN 1024 12#define SM_MAXSTRLEN 1024
13#define SM_PRIV_SIZE 16
14 13
15extern int nsm_local_state; 14extern int nsm_local_state;
16 15
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index d6b3a802c046..6b5199263858 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -13,6 +13,12 @@
13#include <linux/nfs.h> 13#include <linux/nfs.h>
14#include <linux/sunrpc/xdr.h> 14#include <linux/sunrpc/xdr.h>
15 15
16#define SM_PRIV_SIZE 16
17
18struct nsm_private {
19 unsigned char data[SM_PRIV_SIZE];
20};
21
16struct svc_rqst; 22struct svc_rqst;
17 23
18#define NLM_MAXCOOKIELEN 32 24#define NLM_MAXCOOKIELEN 32