From 8a32222e58afb91cdf1390a464ee2c791980d770 Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Fri, 5 Dec 2008 19:03:16 -0500 Subject: [PATCH] --- yaml --- r: 127462 b: refs/heads/master c: 7e44d3bea21fbb9494930d1cd35ca92a9a4a3279 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/lockd/mon.c | 16 ++++++++++++++++ trunk/include/linux/lockd/lockd.h | 1 + trunk/include/linux/lockd/sm_inter.h | 1 - trunk/include/linux/lockd/xdr.h | 6 ++++++ 5 files changed, 24 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 5a59705d16af..c1bb1ac5ef1c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 05f3a9af58180d24a9decedd71d4587935782d70 +refs/heads/master: 7e44d3bea21fbb9494930d1cd35ca92a9a4a3279 diff --git a/trunk/fs/lockd/mon.c b/trunk/fs/lockd/mon.c index 0792900b6281..c8d18cd22b8a 100644 --- a/trunk/fs/lockd/mon.c +++ b/trunk/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 @@ struct nsm_handle *nsm_find(const struct sockaddr *sap, const size_t salen, 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/trunk/include/linux/lockd/lockd.h b/trunk/include/linux/lockd/lockd.h index 8d715363c6ac..194fa8a66398 100644 --- a/trunk/include/linux/lockd/lockd.h +++ b/trunk/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/trunk/include/linux/lockd/sm_inter.h b/trunk/include/linux/lockd/sm_inter.h index 116bf38535a0..5cef5a79dd94 100644 --- a/trunk/include/linux/lockd/sm_inter.h +++ b/trunk/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/trunk/include/linux/lockd/xdr.h b/trunk/include/linux/lockd/xdr.h index d6b3a802c046..6b5199263858 100644 --- a/trunk/include/linux/lockd/xdr.h +++ b/trunk/include/linux/lockd/xdr.h @@ -13,6 +13,12 @@ #include #include +#define SM_PRIV_SIZE 16 + +struct nsm_private { + unsigned char data[SM_PRIV_SIZE]; +}; + struct svc_rqst; #define NLM_MAXCOOKIELEN 32