Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38383
b: refs/heads/master
c: abd1f50
h: refs/heads/master
i:
  38381: 2f81a65
  38379: 31f788c
  38375: af773f1
  38367: 413cead
v: v3
  • Loading branch information
Olaf Kirch authored and Linus Torvalds committed Oct 4, 2006
1 parent 97147cf commit 58a1178
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 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: 350fce8dbf43f7d441b77366851c9ce3cd28d6dc
refs/heads/master: abd1f50094cad9dff6d68ada98b495549f52fc30
6 changes: 5 additions & 1 deletion trunk/fs/lockd/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,11 @@ __nsm_find(const struct sockaddr_in *sin,
list_for_each(pos, &nsm_handles) {
nsm = list_entry(pos, struct nsm_handle, sm_link);

if (!nlm_cmp_addr(&nsm->sm_addr, sin))
if (hostname && nsm_use_hostnames) {
if (strlen(nsm->sm_name) != hostname_len
|| memcmp(nsm->sm_name, hostname, hostname_len))
continue;
} else if (!nlm_cmp_addr(&nsm->sm_addr, sin))
continue;
atomic_inc(&nsm->sm_count);
goto out;
Expand Down
12 changes: 9 additions & 3 deletions trunk/fs/lockd/mon.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
}

memset(&args, 0, sizeof(args));
args.mon_name = nsm->sm_name;
args.addr = nsm->sm_addr.sin_addr.s_addr;
args.prog = NLM_PROGRAM;
args.vers = 3;
Expand Down Expand Up @@ -150,16 +151,21 @@ nsm_create(void)
static u32 *
xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
{
char buffer[20];
char buffer[20], *name;

/*
* Use the dotted-quad IP address of the remote host as
* identifier. Linux statd always looks up the canonical
* hostname first for whatever remote hostname it receives,
* so this works alright.
*/
sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr));
if (!(p = xdr_encode_string(p, buffer))
if (nsm_use_hostnames) {
name = argp->mon_name;
} else {
sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr));
name = buffer;
}
if (!(p = xdr_encode_string(p, name))
|| !(p = xdr_encode_string(p, utsname()->nodename)))
return ERR_PTR(-EIO);
*p++ = htonl(argp->prog);
Expand Down
10 changes: 10 additions & 0 deletions trunk/fs/lockd/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static DECLARE_WAIT_QUEUE_HEAD(lockd_exit);
static unsigned long nlm_grace_period;
static unsigned long nlm_timeout = LOCKD_DFLT_TIMEO;
static int nlm_udpport, nlm_tcpport;
int nsm_use_hostnames = 0;

/*
* Constants needed for the sysctl interface.
Expand Down Expand Up @@ -395,6 +396,14 @@ static ctl_table nlm_sysctls[] = {
.extra1 = (int *) &nlm_port_min,
.extra2 = (int *) &nlm_port_max,
},
{
.ctl_name = CTL_UNNUMBERED,
.procname = "nsm_use_hostnames",
.data = &nsm_use_hostnames,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec,
},
{ .ctl_name = 0 }
};

Expand Down Expand Up @@ -483,6 +492,7 @@ module_param_call(nlm_udpport, param_set_port, param_get_int,
&nlm_udpport, 0644);
module_param_call(nlm_tcpport, param_set_port, param_get_int,
&nlm_tcpport, 0644);
module_param(nsm_use_hostnames, bool, 0644);

/*
* Initialising and terminating the module.
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 @@ -142,6 +142,7 @@ extern struct svc_procedure nlmsvc_procedures4[];
#endif
extern int nlmsvc_grace_period;
extern unsigned long nlmsvc_timeout;
extern int nsm_use_hostnames;

/*
* Lockd client functions
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/lockd/sm_inter.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ struct nsm_args {
u32 prog; /* RPC callback info */
u32 vers;
u32 proc;

char * mon_name;
};

/*
Expand Down

0 comments on commit 58a1178

Please sign in to comment.