Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 127446
b: refs/heads/master
c: 29ed140
h: refs/heads/master
v: v3
  • Loading branch information
Chuck Lever authored and J. Bruce Fields committed Jan 6, 2009
1 parent 4b2b08e commit 6f24093
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 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: f47534f7f0ac7727e05ec4274b764b181df2cf7f
refs/heads/master: 29ed1407ed81086b778ebf12145b048ac3f7e10e
27 changes: 8 additions & 19 deletions trunk/fs/lockd/mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

#define NLMDBG_FACILITY NLMDBG_MONITOR

#define XDR_ADDRBUF_LEN (20)

static struct rpc_clnt * nsm_create(void);

static struct rpc_program nsm_program;
Expand All @@ -42,7 +40,7 @@ nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
.prog = NLM_PROGRAM,
.vers = 3,
.proc = NLMPROC_NSM_NOTIFY,
.mon_name = nsm->sm_name,
.mon_name = nsm->sm_mon_name,
};
struct rpc_message msg = {
.rpc_argp = &args,
Expand Down Expand Up @@ -87,6 +85,12 @@ nsm_monitor(struct nlm_host *host)
if (nsm->sm_monitored)
return 0;

/*
* Choose whether to record the caller_name or IP address of
* this peer in the local rpc.statd's database.
*/
nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf;

status = nsm_mon_unmon(nsm, SM_MON, &res);

if (status < 0 || res.status != 0)
Expand Down Expand Up @@ -167,25 +171,10 @@ static __be32 *xdr_encode_nsm_string(__be32 *p, char *string)

/*
* "mon_name" specifies the host to be monitored.
*
* Linux uses a text version of the IP address of the remote
* host as the host identifier (the "mon_name" argument).
*
* Linux statd always looks up the canonical hostname first for
* whatever remote hostname it receives, so this works alright.
*/
static __be32 *xdr_encode_mon_name(__be32 *p, struct nsm_args *argp)
{
char buffer[XDR_ADDRBUF_LEN + 1];
char *name = argp->mon_name;

if (!nsm_use_hostnames) {
snprintf(buffer, XDR_ADDRBUF_LEN,
"%pI4", &argp->addr);
name = buffer;
}

return xdr_encode_nsm_string(p, name);
return xdr_encode_nsm_string(p, argp->mon_name);
}

/*
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 @@ -79,6 +79,7 @@ struct nlm_host {
struct nsm_handle {
struct list_head sm_link;
atomic_t sm_count;
char *sm_mon_name;
char *sm_name;
struct sockaddr_storage sm_addr;
size_t sm_addrlen;
Expand Down

0 comments on commit 6f24093

Please sign in to comment.