blob: 970659daa323865a113d25075d461c50c7f7dc7c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/fs/nfs/callback.c
3 *
4 * Copyright (C) 2004 Trond Myklebust
5 *
6 * NFSv4 callback handling
7 */
8
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/completion.h>
10#include <linux/ip.h>
11#include <linux/module.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <linux/sunrpc/svc.h>
13#include <linux/sunrpc/svcsock.h>
14#include <linux/nfs_fs.h>
Ingo Molnar353ab6e2006-03-26 01:37:12 -080015#include <linux/mutex.h>
Rafael J. Wysocki83144182007-07-17 04:03:35 -070016#include <linux/freezer.h>
Jeff Laytona277e332008-02-20 08:55:30 -050017#include <linux/kthread.h>
Olga Kornievskaia945b34a2008-12-23 16:18:34 -050018#include <linux/sunrpc/svcauth_gss.h>
Ricardo Labiagaa43cde92009-04-01 09:23:08 -040019#include <linux/sunrpc/bc_xprt.h>
Stanislav Kinsbursky9793f7c2012-05-02 16:08:38 +040020#include <linux/nsproxy.h>
Arnaldo Carvalho de Melo14c85022005-12-27 02:43:12 -020021
22#include <net/inet_sock.h>
23
Trond Myklebust4ce79712005-06-22 17:16:21 +000024#include "nfs4_fs.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include "callback.h"
David Howells24c8dbb2006-08-22 20:06:10 -040026#include "internal.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
28#define NFSDBG_FACILITY NFSDBG_CALLBACK
29
30struct nfs_callback_data {
31 unsigned int users;
Ricardo Labiagaa43cde92009-04-01 09:23:08 -040032 struct svc_serv *serv;
Jeff Layton5afc5972008-06-11 10:03:11 -040033 struct svc_rqst *rqst;
Jeff Laytona277e332008-02-20 08:55:30 -050034 struct task_struct *task;
Linus Torvalds1da177e2005-04-16 15:20:36 -070035};
36
Andy Adamsone82dc222009-04-01 09:23:14 -040037static struct nfs_callback_data nfs_callback_info[NFS4_MAX_MINOR_VERSION + 1];
Ingo Molnar353ab6e2006-03-26 01:37:12 -080038static DEFINE_MUTEX(nfs_callback_mutex);
Linus Torvalds1da177e2005-04-16 15:20:36 -070039static struct svc_program nfs4_callback_program;
40
Trond Myklebusta72b4422006-01-03 09:55:41 +010041unsigned int nfs_callback_set_tcpport;
Linus Torvalds1da177e2005-04-16 15:20:36 -070042unsigned short nfs_callback_tcpport;
Chuck Leverf738f512009-03-18 20:48:06 -040043unsigned short nfs_callback_tcpport6;
Trond Myklebustc140aa92009-08-09 15:06:19 -040044#define NFS_CALLBACK_MAXPORTNR (65535U)
David Howells7d4e2742006-08-22 20:06:07 -040045
Rusty Russell9bbb9e52010-08-11 23:04:12 -060046static int param_set_portnr(const char *val, const struct kernel_param *kp)
David Howells7d4e2742006-08-22 20:06:07 -040047{
Trond Myklebustc140aa92009-08-09 15:06:19 -040048 unsigned long num;
49 int ret;
50
51 if (!val)
David Howells7d4e2742006-08-22 20:06:07 -040052 return -EINVAL;
Trond Myklebustc140aa92009-08-09 15:06:19 -040053 ret = strict_strtoul(val, 0, &num);
54 if (ret == -EINVAL || num > NFS_CALLBACK_MAXPORTNR)
55 return -EINVAL;
56 *((unsigned int *)kp->arg) = num;
David Howells7d4e2742006-08-22 20:06:07 -040057 return 0;
58}
Rusty Russell9bbb9e52010-08-11 23:04:12 -060059static struct kernel_param_ops param_ops_portnr = {
60 .set = param_set_portnr,
61 .get = param_get_uint,
62};
Trond Myklebustc140aa92009-08-09 15:06:19 -040063#define param_check_portnr(name, p) __param_check(name, p, unsigned int);
64
65module_param_named(callback_tcpport, nfs_callback_set_tcpport, portnr, 0644);
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
67/*
Andy Adamsone82dc222009-04-01 09:23:14 -040068 * This is the NFSv4 callback kernel thread.
Linus Torvalds1da177e2005-04-16 15:20:36 -070069 */
Jeff Laytona277e332008-02-20 08:55:30 -050070static int
Benny Halevy71468512009-04-01 09:22:56 -040071nfs4_callback_svc(void *vrqstp)
Linus Torvalds1da177e2005-04-16 15:20:36 -070072{
Jeff Layton06e02d62008-04-08 15:40:07 -040073 int err, preverr = 0;
Jeff Laytona277e332008-02-20 08:55:30 -050074 struct svc_rqst *rqstp = vrqstp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Rafael J. Wysocki83144182007-07-17 04:03:35 -070076 set_freezable();
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Jeff Laytona277e332008-02-20 08:55:30 -050078 while (!kthread_should_stop()) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070079 /*
80 * Listen for a request on the socket
81 */
NeilBrown6fb2b472006-10-02 02:17:50 -070082 err = svc_recv(rqstp, MAX_SCHEDULE_TIMEOUT);
Jeff Layton06e02d62008-04-08 15:40:07 -040083 if (err == -EAGAIN || err == -EINTR) {
84 preverr = err;
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 continue;
Linus Torvalds1da177e2005-04-16 15:20:36 -070086 }
Jeff Layton06e02d62008-04-08 15:40:07 -040087 if (err < 0) {
88 if (err != preverr) {
Weston Andros Adamsona0308892012-01-26 13:32:23 -050089 printk(KERN_WARNING "NFS: %s: unexpected error "
Jeff Layton06e02d62008-04-08 15:40:07 -040090 "from svc_recv (%d)\n", __func__, err);
91 preverr = err;
92 }
93 schedule_timeout_uninterruptible(HZ);
94 continue;
95 }
96 preverr = err;
NeilBrown6fb2b472006-10-02 02:17:50 -070097 svc_process(rqstp);
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 }
Jeff Laytona277e332008-02-20 08:55:30 -050099 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100}
101
102/*
Benny Halevy71468512009-04-01 09:22:56 -0400103 * Prepare to bring up the NFSv4 callback service
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 */
Trond Myklebust17280172012-03-11 13:11:00 -0400105static struct svc_rqst *
Stanislav Kinsbursky7bb782c2012-01-10 16:13:03 +0400106nfs4_callback_up(struct svc_serv *serv, struct rpc_xprt *xprt)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107{
Benny Halevy71468512009-04-01 09:22:56 -0400108 int ret;
Chuck Lever482fb942007-02-12 00:53:29 -0800109
Stanislav Kinsbursky7bb782c2012-01-10 16:13:03 +0400110 ret = svc_create_xprt(serv, "tcp", xprt->xprt_net, PF_INET,
Chuck Lever9652ada2009-03-18 20:46:21 -0400111 nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
Chuck Lever482fb942007-02-12 00:53:29 -0800112 if (ret <= 0)
Jeff Layton8e600292008-02-11 10:00:20 -0500113 goto out_err;
Chuck Lever482fb942007-02-12 00:53:29 -0800114 nfs_callback_tcpport = ret;
Chuck Lever18de9732008-10-16 17:41:11 -0400115 dprintk("NFS: Callback listener port = %u (af %u)\n",
Chuck Lever26298ca2009-03-18 20:46:36 -0400116 nfs_callback_tcpport, PF_INET);
Chuck Lever482fb942007-02-12 00:53:29 -0800117
Stanislav Kinsbursky7bb782c2012-01-10 16:13:03 +0400118 ret = svc_create_xprt(serv, "tcp", xprt->xprt_net, PF_INET6,
Chuck Leverf738f512009-03-18 20:48:06 -0400119 nfs_callback_set_tcpport, SVC_SOCK_ANONYMOUS);
120 if (ret > 0) {
121 nfs_callback_tcpport6 = ret;
122 dprintk("NFS: Callback listener port = %u (af %u)\n",
123 nfs_callback_tcpport6, PF_INET6);
Chuck Lever18fc3162009-06-17 18:02:10 -0700124 } else if (ret == -EAFNOSUPPORT)
125 ret = 0;
126 else
Chuck Leverf738f512009-03-18 20:48:06 -0400127 goto out_err;
Chuck Leverf738f512009-03-18 20:48:06 -0400128
Eric Dumazet11fd1652011-07-28 20:04:09 +0200129 return svc_prepare_thread(serv, &serv->sv_pools[0], NUMA_NO_NODE);
Benny Halevy71468512009-04-01 09:22:56 -0400130
131out_err:
132 if (ret == 0)
133 ret = -ENOMEM;
134 return ERR_PTR(ret);
135}
136
Ricardo Labiagaa43cde92009-04-01 09:23:08 -0400137#if defined(CONFIG_NFS_V4_1)
138/*
139 * The callback service for NFSv4.1 callbacks
140 */
141static int
142nfs41_callback_svc(void *vrqstp)
143{
144 struct svc_rqst *rqstp = vrqstp;
145 struct svc_serv *serv = rqstp->rq_server;
146 struct rpc_rqst *req;
147 int error;
148 DEFINE_WAIT(wq);
149
150 set_freezable();
151
Ricardo Labiagaa43cde92009-04-01 09:23:08 -0400152 while (!kthread_should_stop()) {
153 prepare_to_wait(&serv->sv_cb_waitq, &wq, TASK_INTERRUPTIBLE);
154 spin_lock_bh(&serv->sv_cb_lock);
155 if (!list_empty(&serv->sv_cb_list)) {
156 req = list_first_entry(&serv->sv_cb_list,
157 struct rpc_rqst, rq_bc_list);
158 list_del(&req->rq_bc_list);
159 spin_unlock_bh(&serv->sv_cb_lock);
160 dprintk("Invoking bc_svc_process()\n");
161 error = bc_svc_process(serv, req, rqstp);
162 dprintk("bc_svc_process() returned w/ error code= %d\n",
163 error);
164 } else {
165 spin_unlock_bh(&serv->sv_cb_lock);
166 schedule();
167 }
168 finish_wait(&serv->sv_cb_waitq, &wq);
169 }
Ricardo Labiagaa43cde92009-04-01 09:23:08 -0400170 return 0;
171}
172
173/*
174 * Bring up the NFSv4.1 callback service
175 */
Trond Myklebust17280172012-03-11 13:11:00 -0400176static struct svc_rqst *
Ricardo Labiagaa43cde92009-04-01 09:23:08 -0400177nfs41_callback_up(struct svc_serv *serv, struct rpc_xprt *xprt)
178{
Andy Adamson01c9a0b2011-01-06 02:04:28 +0000179 struct svc_rqst *rqstp;
180 int ret;
Benny Halevy8f975242009-04-01 09:23:11 -0400181
Andy Adamson01c9a0b2011-01-06 02:04:28 +0000182 /*
183 * Create an svc_sock for the back channel service that shares the
184 * fore channel connection.
185 * Returns the input port (0) and sets the svc_serv bc_xprt on success
186 */
Stanislav Kinsbursky7bb782c2012-01-10 16:13:03 +0400187 ret = svc_create_xprt(serv, "tcp-bc", xprt->xprt_net, PF_INET, 0,
Andy Adamson01c9a0b2011-01-06 02:04:28 +0000188 SVC_SOCK_ANONYMOUS);
189 if (ret < 0) {
190 rqstp = ERR_PTR(ret);
Benny Halevy8f975242009-04-01 09:23:11 -0400191 goto out;
Andy Adamson01c9a0b2011-01-06 02:04:28 +0000192 }
Benny Halevy8f975242009-04-01 09:23:11 -0400193
Ricardo Labiagaa43cde92009-04-01 09:23:08 -0400194 /*
195 * Save the svc_serv in the transport so that it can
196 * be referenced when the session backchannel is initialized
197 */
198 xprt->bc_serv = serv;
199
200 INIT_LIST_HEAD(&serv->sv_cb_list);
201 spin_lock_init(&serv->sv_cb_lock);
202 init_waitqueue_head(&serv->sv_cb_waitq);
Eric Dumazet11fd1652011-07-28 20:04:09 +0200203 rqstp = svc_prepare_thread(serv, &serv->sv_pools[0], NUMA_NO_NODE);
Andy Adamson01c9a0b2011-01-06 02:04:28 +0000204 if (IS_ERR(rqstp)) {
Andy Adamson4a19de02011-01-06 02:04:35 +0000205 svc_xprt_put(serv->sv_bc_xprt);
206 serv->sv_bc_xprt = NULL;
Andy Adamson01c9a0b2011-01-06 02:04:28 +0000207 }
Benny Halevy8f975242009-04-01 09:23:11 -0400208out:
Andy Adamson01c9a0b2011-01-06 02:04:28 +0000209 dprintk("--> %s return %ld\n", __func__,
210 IS_ERR(rqstp) ? PTR_ERR(rqstp) : 0);
Benny Halevy8f975242009-04-01 09:23:11 -0400211 return rqstp;
Ricardo Labiagaa43cde92009-04-01 09:23:08 -0400212}
213
214static inline int nfs_minorversion_callback_svc_setup(u32 minorversion,
215 struct svc_serv *serv, struct rpc_xprt *xprt,
216 struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp))
217{
218 if (minorversion) {
219 *rqstpp = nfs41_callback_up(serv, xprt);
220 *callback_svc = nfs41_callback_svc;
221 }
222 return minorversion;
223}
224
225static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
226 struct nfs_callback_data *cb_info)
227{
228 if (minorversion)
229 xprt->bc_serv = cb_info->serv;
230}
231#else
232static inline int nfs_minorversion_callback_svc_setup(u32 minorversion,
233 struct svc_serv *serv, struct rpc_xprt *xprt,
234 struct svc_rqst **rqstpp, int (**callback_svc)(void *vrqstp))
235{
236 return 0;
237}
238
239static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt,
240 struct nfs_callback_data *cb_info)
241{
242}
243#endif /* CONFIG_NFS_V4_1 */
244
Benny Halevy71468512009-04-01 09:22:56 -0400245/*
246 * Bring up the callback thread if it is not already up.
247 */
248int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt)
249{
250 struct svc_serv *serv = NULL;
251 struct svc_rqst *rqstp;
252 int (*callback_svc)(void *vrqstp);
Andy Adamsone82dc222009-04-01 09:23:14 -0400253 struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion];
Benny Halevy71468512009-04-01 09:22:56 -0400254 char svc_name[12];
255 int ret = 0;
Ricardo Labiagaa43cde92009-04-01 09:23:08 -0400256 int minorversion_setup;
Stanislav Kinsbursky9793f7c2012-05-02 16:08:38 +0400257 struct net *net = current->nsproxy->net_ns;
Benny Halevy71468512009-04-01 09:22:56 -0400258
259 mutex_lock(&nfs_callback_mutex);
Andy Adamsone82dc222009-04-01 09:23:14 -0400260 if (cb_info->users++ || cb_info->task != NULL) {
261 nfs_callback_bc_serv(minorversion, xprt, cb_info);
Benny Halevy71468512009-04-01 09:22:56 -0400262 goto out;
Ricardo Labiagaa43cde92009-04-01 09:23:08 -0400263 }
Benny Halevy71468512009-04-01 09:22:56 -0400264 serv = svc_create(&nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, NULL);
265 if (!serv) {
266 ret = -ENOMEM;
267 goto out_err;
268 }
269
Stanislav Kinsbursky9793f7c2012-05-02 16:08:38 +0400270 ret = svc_bind(serv, net);
271 if (ret < 0) {
272 printk(KERN_WARNING "NFS: bind callback service failed\n");
273 goto out_err;
274 }
275
Ricardo Labiagaa43cde92009-04-01 09:23:08 -0400276 minorversion_setup = nfs_minorversion_callback_svc_setup(minorversion,
277 serv, xprt, &rqstp, &callback_svc);
278 if (!minorversion_setup) {
279 /* v4.0 callback setup */
Stanislav Kinsbursky7bb782c2012-01-10 16:13:03 +0400280 rqstp = nfs4_callback_up(serv, xprt);
Benny Halevy71468512009-04-01 09:22:56 -0400281 callback_svc = nfs4_callback_svc;
Benny Halevy71468512009-04-01 09:22:56 -0400282 }
283
284 if (IS_ERR(rqstp)) {
285 ret = PTR_ERR(rqstp);
Jeff Layton8e600292008-02-11 10:00:20 -0500286 goto out_err;
Jeff Laytona277e332008-02-20 08:55:30 -0500287 }
288
289 svc_sock_update_bufs(serv);
Jeff Laytona277e332008-02-20 08:55:30 -0500290
Benny Halevy71468512009-04-01 09:22:56 -0400291 sprintf(svc_name, "nfsv4.%u-svc", minorversion);
Andy Adamsone82dc222009-04-01 09:23:14 -0400292 cb_info->serv = serv;
293 cb_info->rqst = rqstp;
294 cb_info->task = kthread_run(callback_svc, cb_info->rqst, svc_name);
295 if (IS_ERR(cb_info->task)) {
296 ret = PTR_ERR(cb_info->task);
297 svc_exit_thread(cb_info->rqst);
298 cb_info->rqst = NULL;
299 cb_info->task = NULL;
Jeff Laytona277e332008-02-20 08:55:30 -0500300 goto out_err;
301 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700302out:
Jeff Layton8e600292008-02-11 10:00:20 -0500303 /*
304 * svc_create creates the svc_serv with sv_nrthreads == 1, and then
Jeff Laytona277e332008-02-20 08:55:30 -0500305 * svc_prepare_thread increments that. So we need to call svc_destroy
Jeff Layton8e600292008-02-11 10:00:20 -0500306 * on both success and failure so that the refcount is 1 when the
307 * thread exits.
308 */
309 if (serv)
310 svc_destroy(serv);
Ingo Molnar353ab6e2006-03-26 01:37:12 -0800311 mutex_unlock(&nfs_callback_mutex);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 return ret;
Jeff Layton8e600292008-02-11 10:00:20 -0500313out_err:
Chuck Lever18de9732008-10-16 17:41:11 -0400314 dprintk("NFS: Couldn't create callback socket or server thread; "
315 "err = %d\n", ret);
Andy Adamsone82dc222009-04-01 09:23:14 -0400316 cb_info->users--;
Stanislav Kinsbursky786185b2012-05-04 12:49:41 +0400317 if (serv)
318 svc_shutdown_net(serv, net);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700319 goto out;
320}
321
322/*
Jeff Layton5afc5972008-06-11 10:03:11 -0400323 * Kill the callback thread if it's no longer being used.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700324 */
Andy Adamsone82dc222009-04-01 09:23:14 -0400325void nfs_callback_down(int minorversion)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326{
Andy Adamsone82dc222009-04-01 09:23:14 -0400327 struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion];
328
Ingo Molnar353ab6e2006-03-26 01:37:12 -0800329 mutex_lock(&nfs_callback_mutex);
Andy Adamsone82dc222009-04-01 09:23:14 -0400330 cb_info->users--;
331 if (cb_info->users == 0 && cb_info->task != NULL) {
332 kthread_stop(cb_info->task);
Stanislav Kinsbursky786185b2012-05-04 12:49:41 +0400333 svc_shutdown_net(cb_info->serv, current->nsproxy->net_ns);
Andy Adamsone82dc222009-04-01 09:23:14 -0400334 svc_exit_thread(cb_info->rqst);
335 cb_info->serv = NULL;
336 cb_info->rqst = NULL;
337 cb_info->task = NULL;
Jeff Layton5afc5972008-06-11 10:03:11 -0400338 }
Ingo Molnar353ab6e2006-03-26 01:37:12 -0800339 mutex_unlock(&nfs_callback_mutex);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340}
341
Andy Adamson778be232011-01-25 15:38:01 +0000342/* Boolean check of RPC_AUTH_GSS principal */
343int
344check_gss_callback_principal(struct nfs_client *clp, struct svc_rqst *rqstp)
Olga Kornievskaia945b34a2008-12-23 16:18:34 -0500345{
J. Bruce Fields03a4e1f2012-05-14 19:55:22 -0400346 char *p = rqstp->rq_cred.cr_principal;
Olga Kornievskaia945b34a2008-12-23 16:18:34 -0500347
Andy Adamson778be232011-01-25 15:38:01 +0000348 if (rqstp->rq_authop->flavour != RPC_AUTH_GSS)
349 return 1;
350
Andy Adamsonece0de62011-01-06 02:04:33 +0000351 /* No RPC_AUTH_GSS on NFSv4.1 back channel yet */
352 if (clp->cl_minorversion != 0)
Andy Adamson778be232011-01-25 15:38:01 +0000353 return 0;
Olga Kornievskaia945b34a2008-12-23 16:18:34 -0500354 /*
355 * It might just be a normal user principal, in which case
356 * userspace won't bother to tell us the name at all.
357 */
358 if (p == NULL)
Andy Adamson778be232011-01-25 15:38:01 +0000359 return 0;
Olga Kornievskaia945b34a2008-12-23 16:18:34 -0500360
361 /* Expect a GSS_C_NT_HOSTBASED_NAME like "nfs@serverhostname" */
362
363 if (memcmp(p, "nfs@", 4) != 0)
Andy Adamson778be232011-01-25 15:38:01 +0000364 return 0;
Olga Kornievskaia945b34a2008-12-23 16:18:34 -0500365 p += 4;
Trond Myklebust4e0038b2012-03-01 17:01:05 -0500366 if (strcmp(p, clp->cl_hostname) != 0)
Andy Adamson778be232011-01-25 15:38:01 +0000367 return 0;
368 return 1;
Olga Kornievskaia945b34a2008-12-23 16:18:34 -0500369}
370
Andy Adamson778be232011-01-25 15:38:01 +0000371/*
372 * pg_authenticate method for nfsv4 callback threads.
373 *
374 * The authflavor has been negotiated, so an incorrect flavor is a server
375 * bug. Drop packets with incorrect authflavor.
376 *
377 * All other checking done after NFS decoding where the nfs_client can be
378 * found in nfs4_callback_compound
379 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380static int nfs_callback_authenticate(struct svc_rqst *rqstp)
381{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700382 switch (rqstp->rq_authop->flavour) {
Andy Adamson778be232011-01-25 15:38:01 +0000383 case RPC_AUTH_NULL:
384 if (rqstp->rq_proc != CB_NULL)
385 return SVC_DROP;
386 break;
387 case RPC_AUTH_GSS:
388 /* No RPC_AUTH_GSS support yet in NFSv4.1 */
389 if (svc_is_backchannel(rqstp))
390 return SVC_DROP;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700391 }
Andy Adamson778be232011-01-25 15:38:01 +0000392 return SVC_OK;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700393}
394
395/*
396 * Define NFS4 callback program
397 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700398static struct svc_version *nfs4_callback_version[] = {
399 [1] = &nfs4_callback_version1,
Alexandros Batsakis07bccc22009-12-05 13:19:01 -0500400 [4] = &nfs4_callback_version4,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401};
402
403static struct svc_stat nfs4_callback_stats;
404
405static struct svc_program nfs4_callback_program = {
406 .pg_prog = NFS4_CALLBACK, /* RPC service number */
407 .pg_nvers = ARRAY_SIZE(nfs4_callback_version), /* Number of entries */
408 .pg_vers = nfs4_callback_version, /* version table */
409 .pg_name = "NFSv4 callback", /* service name */
410 .pg_class = "nfs", /* authentication class */
411 .pg_stats = &nfs4_callback_stats,
412 .pg_authenticate = nfs_callback_authenticate,
413};