aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/mon.c
diff options
context:
space:
mode:
authorOlaf Kirch <okir@suse.de>2006-10-04 05:16:01 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-04 10:55:17 -0400
commitabd1f50094cad9dff6d68ada98b495549f52fc30 (patch)
treedd738067aa90af1cb4613a7c711ee426ff5f8ae9 /fs/lockd/mon.c
parent350fce8dbf43f7d441b77366851c9ce3cd28d6dc (diff)
[PATCH] knfsd: lockd: optionally use hostnames for identifying peers
This patch adds the nsm_use_hostnames sysctl and module param. If set, lockd will use the client's name (as given in the NLM arguments) to find the NSM handle. This makes recovery work when the NFS peer is multi-homed, and the reboot notification arrives from a different IP than the original lock calls. Signed-off-by: Olaf Kirch <okir@suse.de> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/lockd/mon.c')
-rw-r--r--fs/lockd/mon.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 626b6c116a6d..709cf7c80545 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -47,6 +47,7 @@ nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
47 } 47 }
48 48
49 memset(&args, 0, sizeof(args)); 49 memset(&args, 0, sizeof(args));
50 args.mon_name = nsm->sm_name;
50 args.addr = nsm->sm_addr.sin_addr.s_addr; 51 args.addr = nsm->sm_addr.sin_addr.s_addr;
51 args.prog = NLM_PROGRAM; 52 args.prog = NLM_PROGRAM;
52 args.vers = 3; 53 args.vers = 3;
@@ -150,7 +151,7 @@ nsm_create(void)
150static u32 * 151static u32 *
151xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp) 152xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
152{ 153{
153 char buffer[20]; 154 char buffer[20], *name;
154 155
155 /* 156 /*
156 * Use the dotted-quad IP address of the remote host as 157 * Use the dotted-quad IP address of the remote host as
@@ -158,8 +159,13 @@ xdr_encode_common(struct rpc_rqst *rqstp, u32 *p, struct nsm_args *argp)
158 * hostname first for whatever remote hostname it receives, 159 * hostname first for whatever remote hostname it receives,
159 * so this works alright. 160 * so this works alright.
160 */ 161 */
161 sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr)); 162 if (nsm_use_hostnames) {
162 if (!(p = xdr_encode_string(p, buffer)) 163 name = argp->mon_name;
164 } else {
165 sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(argp->addr));
166 name = buffer;
167 }
168 if (!(p = xdr_encode_string(p, name))
163 || !(p = xdr_encode_string(p, utsname()->nodename))) 169 || !(p = xdr_encode_string(p, utsname()->nodename)))
164 return ERR_PTR(-EIO); 170 return ERR_PTR(-EIO);
165 *p++ = htonl(argp->prog); 171 *p++ = htonl(argp->prog);