diff options
Diffstat (limited to 'fs/nfs/callback.c')
| -rw-r--r-- | fs/nfs/callback.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 90c95adc8c1b..a3ee11364db0 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | * NFSv4 callback handling | 6 | * NFSv4 callback handling |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/config.h> | ||
| 10 | #include <linux/completion.h> | 9 | #include <linux/completion.h> |
| 11 | #include <linux/ip.h> | 10 | #include <linux/ip.h> |
| 12 | #include <linux/module.h> | 11 | #include <linux/module.h> |
| @@ -20,6 +19,7 @@ | |||
| 20 | 19 | ||
| 21 | #include "nfs4_fs.h" | 20 | #include "nfs4_fs.h" |
| 22 | #include "callback.h" | 21 | #include "callback.h" |
| 22 | #include "internal.h" | ||
| 23 | 23 | ||
| 24 | #define NFSDBG_FACILITY NFSDBG_CALLBACK | 24 | #define NFSDBG_FACILITY NFSDBG_CALLBACK |
| 25 | 25 | ||
| @@ -37,6 +37,21 @@ static struct svc_program nfs4_callback_program; | |||
| 37 | 37 | ||
| 38 | unsigned int nfs_callback_set_tcpport; | 38 | unsigned int nfs_callback_set_tcpport; |
| 39 | unsigned short nfs_callback_tcpport; | 39 | unsigned short nfs_callback_tcpport; |
| 40 | static const int nfs_set_port_min = 0; | ||
| 41 | static const int nfs_set_port_max = 65535; | ||
| 42 | |||
| 43 | static 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 | |||
| 53 | module_param_call(callback_tcpport, param_set_port, param_get_int, | ||
| 54 | &nfs_callback_set_tcpport, 0644); | ||
| 40 | 55 | ||
| 41 | /* | 56 | /* |
| 42 | * This is the callback kernel thread. | 57 | * This is the callback kernel thread. |
| @@ -135,10 +150,8 @@ out_err: | |||
| 135 | /* | 150 | /* |
| 136 | * Kill the server process if it is not already up. | 151 | * Kill the server process if it is not already up. |
| 137 | */ | 152 | */ |
| 138 | int nfs_callback_down(void) | 153 | void nfs_callback_down(void) |
| 139 | { | 154 | { |
| 140 | int ret = 0; | ||
| 141 | |||
| 142 | lock_kernel(); | 155 | lock_kernel(); |
| 143 | mutex_lock(&nfs_callback_mutex); | 156 | mutex_lock(&nfs_callback_mutex); |
| 144 | nfs_callback_info.users--; | 157 | nfs_callback_info.users--; |
| @@ -150,20 +163,19 @@ int nfs_callback_down(void) | |||
| 150 | } 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); |
| 151 | mutex_unlock(&nfs_callback_mutex); | 164 | mutex_unlock(&nfs_callback_mutex); |
| 152 | unlock_kernel(); | 165 | unlock_kernel(); |
| 153 | return ret; | ||
| 154 | } | 166 | } |
| 155 | 167 | ||
| 156 | static int nfs_callback_authenticate(struct svc_rqst *rqstp) | 168 | static int nfs_callback_authenticate(struct svc_rqst *rqstp) |
| 157 | { | 169 | { |
| 158 | struct in_addr *addr = &rqstp->rq_addr.sin_addr; | 170 | struct sockaddr_in *addr = &rqstp->rq_addr; |
| 159 | struct nfs4_client *clp; | 171 | struct nfs_client *clp; |
| 160 | 172 | ||
| 161 | /* Don't talk to strangers */ | 173 | /* Don't talk to strangers */ |
| 162 | clp = nfs4_find_client(addr); | 174 | clp = nfs_find_client(addr, 4); |
| 163 | if (clp == NULL) | 175 | if (clp == NULL) |
| 164 | return SVC_DROP; | 176 | return SVC_DROP; |
| 165 | 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)); |
| 166 | nfs4_put_client(clp); | 178 | nfs_put_client(clp); |
| 167 | switch (rqstp->rq_authop->flavour) { | 179 | switch (rqstp->rq_authop->flavour) { |
| 168 | case RPC_AUTH_NULL: | 180 | case RPC_AUTH_NULL: |
| 169 | if (rqstp->rq_proc != CB_NULL) | 181 | if (rqstp->rq_proc != CB_NULL) |
| @@ -182,8 +194,6 @@ static int nfs_callback_authenticate(struct svc_rqst *rqstp) | |||
| 182 | /* | 194 | /* |
| 183 | * Define NFS4 callback program | 195 | * Define NFS4 callback program |
| 184 | */ | 196 | */ |
| 185 | extern struct svc_version nfs4_callback_version1; | ||
| 186 | |||
| 187 | static struct svc_version *nfs4_callback_version[] = { | 197 | static struct svc_version *nfs4_callback_version[] = { |
| 188 | [1] = &nfs4_callback_version1, | 198 | [1] = &nfs4_callback_version1, |
| 189 | }; | 199 | }; |
