aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/callback.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-23 19:58:40 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-23 19:58:40 -0400
commit9f261e011340bcd22c1dd48b465153bd78caa8c8 (patch)
treeb1c266ea746a0e8591e6af781aef22854e652ff9 /fs/nfs/callback.c
parenta4c12d6c5dde48c69464baf7c703e425ee511433 (diff)
parent026ed5c9185dcc4b2df92e98c3d61a01cea19cbf (diff)
Merge git://git.linux-nfs.org/pub/linux/nfs-2.6
* git://git.linux-nfs.org/pub/linux/nfs-2.6: (74 commits) NFS: unmark NFS direct I/O as experimental NFS: add comments clarifying the use of nfs_post_op_update() NFSv4: rpc_mkpipe creating socket inodes w/out sk buffers NFS: Use SEEK_END instead of hardcoded value NFSv4: When mounting with a port=0 argument, substitute port=2049 NFSv4: Poll more aggressively when handling NFS4ERR_DELAY NFSv4: Handle the condition NFS4ERR_FILE_OPEN NFSv4: Retry lease recovery if it failed during a synchronous operation. NFS: Don't invalidate the symlink we just stuffed into the cache NFS: Make read() return an ESTALE if the file has been deleted NFSv4: It's perfectly legal for clp to be NULL here.... NFS: nfs_lookup - don't hash dentry when optimising away the lookup SUNRPC: Fix Oops in pmap_getport_done SUNRPC: Add refcounting to the struct rpc_xprt SUNRPC: Clean up soft task error handling SUNRPC: Handle ENETUNREACH, EHOSTUNREACH and EHOSTDOWN socket errors SUNRPC: rpc_delay() should not clobber the rpc_task->tk_status Fix a referral error Oops NFS: NFS_ROOT should use the new rpc_create API NFS: Fix up compiler warnings on 64-bit platforms in client.c ... Manually resolved conflict in net/sunrpc/xprtsock.c
Diffstat (limited to 'fs/nfs/callback.c')
-rw-r--r--fs/nfs/callback.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index fe0a6b8ac149..a3ee11364db0 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -19,6 +19,7 @@
19 19
20#include "nfs4_fs.h" 20#include "nfs4_fs.h"
21#include "callback.h" 21#include "callback.h"
22#include "internal.h"
22 23
23#define NFSDBG_FACILITY NFSDBG_CALLBACK 24#define NFSDBG_FACILITY NFSDBG_CALLBACK
24 25
@@ -36,6 +37,21 @@ static struct svc_program nfs4_callback_program;
36 37
37unsigned int nfs_callback_set_tcpport; 38unsigned int nfs_callback_set_tcpport;
38unsigned short nfs_callback_tcpport; 39unsigned short nfs_callback_tcpport;
40static const int nfs_set_port_min = 0;
41static const int nfs_set_port_max = 65535;
42
43static int param_set_port(const char *val, struct kernel_param *kp)
44{
45 char *endp;
46 int num = simple_strtol(val, &endp, 0);
47 if (endp == val || *endp || num < nfs_set_port_min || num > nfs_set_port_max)
48 return -EINVAL;
49 *((int *)kp->arg) = num;
50 return 0;
51}
52
53module_param_call(callback_tcpport, param_set_port, param_get_int,
54 &nfs_callback_set_tcpport, 0644);
39 55
40/* 56/*
41 * This is the callback kernel thread. 57 * This is the callback kernel thread.
@@ -134,10 +150,8 @@ out_err:
134/* 150/*
135 * Kill the server process if it is not already up. 151 * Kill the server process if it is not already up.
136 */ 152 */
137int nfs_callback_down(void) 153void nfs_callback_down(void)
138{ 154{
139 int ret = 0;
140
141 lock_kernel(); 155 lock_kernel();
142 mutex_lock(&nfs_callback_mutex); 156 mutex_lock(&nfs_callback_mutex);
143 nfs_callback_info.users--; 157 nfs_callback_info.users--;
@@ -149,20 +163,19 @@ int nfs_callback_down(void)
149 } while (wait_for_completion_timeout(&nfs_callback_info.stopped, 5*HZ) == 0); 163 } while (wait_for_completion_timeout(&nfs_callback_info.stopped, 5*HZ) == 0);
150 mutex_unlock(&nfs_callback_mutex); 164 mutex_unlock(&nfs_callback_mutex);
151 unlock_kernel(); 165 unlock_kernel();
152 return ret;
153} 166}
154 167
155static int nfs_callback_authenticate(struct svc_rqst *rqstp) 168static int nfs_callback_authenticate(struct svc_rqst *rqstp)
156{ 169{
157 struct in_addr *addr = &rqstp->rq_addr.sin_addr; 170 struct sockaddr_in *addr = &rqstp->rq_addr;
158 struct nfs4_client *clp; 171 struct nfs_client *clp;
159 172
160 /* Don't talk to strangers */ 173 /* Don't talk to strangers */
161 clp = nfs4_find_client(addr); 174 clp = nfs_find_client(addr, 4);
162 if (clp == NULL) 175 if (clp == NULL)
163 return SVC_DROP; 176 return SVC_DROP;
164 dprintk("%s: %u.%u.%u.%u NFSv4 callback!\n", __FUNCTION__, NIPQUAD(addr)); 177 dprintk("%s: %u.%u.%u.%u NFSv4 callback!\n", __FUNCTION__, NIPQUAD(addr->sin_addr));
165 nfs4_put_client(clp); 178 nfs_put_client(clp);
166 switch (rqstp->rq_authop->flavour) { 179 switch (rqstp->rq_authop->flavour) {
167 case RPC_AUTH_NULL: 180 case RPC_AUTH_NULL:
168 if (rqstp->rq_proc != CB_NULL) 181 if (rqstp->rq_proc != CB_NULL)