Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127462
b: refs/heads/master
c: 7e44d3b
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and J. Bruce Fields committed Jan 6, 2009
1 parent c2d6b48 commit 8a32222
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 05f3a9af58180d24a9decedd71d4587935782d70
refs/heads/master: 7e44d3bea21fbb9494930d1cd35ca92a9a4a3279
16 changes: 16 additions & 0 deletions trunk/fs/lockd/mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/lockd/lockd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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];
};

Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/lockd/sm_inter.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#define LINUX_LOCKD_SM_INTER_H

#define SM_MAXSTRLEN 1024
#define SM_PRIV_SIZE 16

extern int nsm_local_state;

Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/lockd/xdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8a32222

Please sign in to comment.