svc.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. /*
  2. * linux/fs/lockd/svc.c
  3. *
  4. * This is the central lockd service.
  5. *
  6. * FIXME: Separate the lockd NFS server functionality from the lockd NFS
  7. * client functionality. Oh why didn't Sun create two separate
  8. * services in the first place?
  9. *
  10. * Authors: Olaf Kirch (okir@monad.swb.de)
  11. *
  12. * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
  13. */
  14. #include <linux/module.h>
  15. #include <linux/init.h>
  16. #include <linux/sysctl.h>
  17. #include <linux/moduleparam.h>
  18. #include <linux/sched.h>
  19. #include <linux/errno.h>
  20. #include <linux/in.h>
  21. #include <linux/uio.h>
  22. #include <linux/smp.h>
  23. #include <linux/mutex.h>
  24. #include <linux/kthread.h>
  25. #include <linux/freezer.h>
  26. #include <linux/sunrpc/types.h>
  27. #include <linux/sunrpc/stats.h>
  28. #include <linux/sunrpc/clnt.h>
  29. #include <linux/sunrpc/svc.h>
  30. #include <linux/sunrpc/svcsock.h>
  31. #include <net/ip.h>
  32. #include <linux/lockd/lockd.h>
  33. #include <linux/nfs.h>
  34. #include "netns.h"
  35. #include "procfs.h"
  36. #define NLMDBG_FACILITY NLMDBG_SVC
  37. #define LOCKD_BUFSIZE (1024 + NLMSVC_XDRSIZE)
  38. #define ALLOWED_SIGS (sigmask(SIGKILL))
  39. static struct svc_program nlmsvc_program;
  40. struct nlmsvc_binding * nlmsvc_ops;
  41. EXPORT_SYMBOL_GPL(nlmsvc_ops);
  42. static DEFINE_MUTEX(nlmsvc_mutex);
  43. static unsigned int nlmsvc_users;
  44. static struct task_struct *nlmsvc_task;
  45. static struct svc_rqst *nlmsvc_rqst;
  46. unsigned long nlmsvc_timeout;
  47. int lockd_net_id;
  48. /*
  49. * These can be set at insmod time (useful for NFS as root filesystem),
  50. * and also changed through the sysctl interface. -- Jamie Lokier, Aug 2003
  51. */
  52. static unsigned long nlm_grace_period;
  53. static unsigned long nlm_timeout = LOCKD_DFLT_TIMEO;
  54. static int nlm_udpport, nlm_tcpport;
  55. /* RLIM_NOFILE defaults to 1024. That seems like a reasonable default here. */
  56. static unsigned int nlm_max_connections = 1024;
  57. /*
  58. * Constants needed for the sysctl interface.
  59. */
  60. static const unsigned long nlm_grace_period_min = 0;
  61. static const unsigned long nlm_grace_period_max = 240;
  62. static const unsigned long nlm_timeout_min = 3;
  63. static const unsigned long nlm_timeout_max = 20;
  64. static const int nlm_port_min = 0, nlm_port_max = 65535;
  65. #ifdef CONFIG_SYSCTL
  66. static struct ctl_table_header * nlm_sysctl_table;
  67. #endif
  68. static unsigned long get_lockd_grace_period(void)
  69. {
  70. /* Note: nlm_timeout should always be nonzero */
  71. if (nlm_grace_period)
  72. return roundup(nlm_grace_period, nlm_timeout) * HZ;
  73. else
  74. return nlm_timeout * 5 * HZ;
  75. }
  76. static void grace_ender(struct work_struct *grace)
  77. {
  78. struct delayed_work *dwork = container_of(grace, struct delayed_work,
  79. work);
  80. struct lockd_net *ln = container_of(dwork, struct lockd_net,
  81. grace_period_end);
  82. locks_end_grace(&ln->lockd_manager);
  83. }
  84. static void set_grace_period(struct net *net)
  85. {
  86. unsigned long grace_period = get_lockd_grace_period();
  87. struct lockd_net *ln = net_generic(net, lockd_net_id);
  88. locks_start_grace(net, &ln->lockd_manager);
  89. cancel_delayed_work_sync(&ln->grace_period_end);
  90. schedule_delayed_work(&ln->grace_period_end, grace_period);
  91. }
  92. static void restart_grace(void)
  93. {
  94. if (nlmsvc_ops) {
  95. struct net *net = &init_net;
  96. struct lockd_net *ln = net_generic(net, lockd_net_id);
  97. cancel_delayed_work_sync(&ln->grace_period_end);
  98. locks_end_grace(&ln->lockd_manager);
  99. nlmsvc_invalidate_all();
  100. set_grace_period(net);
  101. }
  102. }
  103. /*
  104. * This is the lockd kernel thread
  105. */
  106. static int
  107. lockd(void *vrqstp)
  108. {
  109. int err = 0;
  110. struct svc_rqst *rqstp = vrqstp;
  111. /* try_to_freeze() is called from svc_recv() */
  112. set_freezable();
  113. /* Allow SIGKILL to tell lockd to drop all of its locks */
  114. allow_signal(SIGKILL);
  115. dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n");
  116. /*
  117. * The main request loop. We don't terminate until the last
  118. * NFS mount or NFS daemon has gone away.
  119. */
  120. while (!kthread_should_stop()) {
  121. long timeout = MAX_SCHEDULE_TIMEOUT;
  122. RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]);
  123. /* update sv_maxconn if it has changed */
  124. rqstp->rq_server->sv_maxconn = nlm_max_connections;
  125. if (signalled()) {
  126. flush_signals(current);
  127. restart_grace();
  128. continue;
  129. }
  130. timeout = nlmsvc_retry_blocked();
  131. /*
  132. * Find a socket with data available and call its
  133. * recvfrom routine.
  134. */
  135. err = svc_recv(rqstp, timeout);
  136. if (err == -EAGAIN || err == -EINTR)
  137. continue;
  138. dprintk("lockd: request from %s\n",
  139. svc_print_addr(rqstp, buf, sizeof(buf)));
  140. svc_process(rqstp);
  141. }
  142. flush_signals(current);
  143. if (nlmsvc_ops)
  144. nlmsvc_invalidate_all();
  145. nlm_shutdown_hosts();
  146. return 0;
  147. }
  148. static int create_lockd_listener(struct svc_serv *serv, const char *name,
  149. struct net *net, const int family,
  150. const unsigned short port)
  151. {
  152. struct svc_xprt *xprt;
  153. xprt = svc_find_xprt(serv, name, net, family, 0);
  154. if (xprt == NULL)
  155. return svc_create_xprt(serv, name, net, family, port,
  156. SVC_SOCK_DEFAULTS);
  157. svc_xprt_put(xprt);
  158. return 0;
  159. }
  160. static int create_lockd_family(struct svc_serv *serv, struct net *net,
  161. const int family)
  162. {
  163. int err;
  164. err = create_lockd_listener(serv, "udp", net, family, nlm_udpport);
  165. if (err < 0)
  166. return err;
  167. return create_lockd_listener(serv, "tcp", net, family, nlm_tcpport);
  168. }
  169. /*
  170. * Ensure there are active UDP and TCP listeners for lockd.
  171. *
  172. * Even if we have only TCP NFS mounts and/or TCP NFSDs, some
  173. * local services (such as rpc.statd) still require UDP, and
  174. * some NFS servers do not yet support NLM over TCP.
  175. *
  176. * Returns zero if all listeners are available; otherwise a
  177. * negative errno value is returned.
  178. */
  179. static int make_socks(struct svc_serv *serv, struct net *net)
  180. {
  181. static int warned;
  182. int err;
  183. err = create_lockd_family(serv, net, PF_INET);
  184. if (err < 0)
  185. goto out_err;
  186. err = create_lockd_family(serv, net, PF_INET6);
  187. if (err < 0 && err != -EAFNOSUPPORT)
  188. goto out_err;
  189. warned = 0;
  190. return 0;
  191. out_err:
  192. if (warned++ == 0)
  193. printk(KERN_WARNING
  194. "lockd_up: makesock failed, error=%d\n", err);
  195. svc_shutdown_net(serv, net);
  196. return err;
  197. }
  198. static int lockd_up_net(struct svc_serv *serv, struct net *net)
  199. {
  200. struct lockd_net *ln = net_generic(net, lockd_net_id);
  201. int error;
  202. if (ln->nlmsvc_users++)
  203. return 0;
  204. error = svc_bind(serv, net);
  205. if (error)
  206. goto err_bind;
  207. error = make_socks(serv, net);
  208. if (error < 0)
  209. goto err_bind;
  210. set_grace_period(net);
  211. dprintk("lockd_up_net: per-net data created; net=%p\n", net);
  212. return 0;
  213. err_bind:
  214. ln->nlmsvc_users--;
  215. return error;
  216. }
  217. static void lockd_down_net(struct svc_serv *serv, struct net *net)
  218. {
  219. struct lockd_net *ln = net_generic(net, lockd_net_id);
  220. if (ln->nlmsvc_users) {
  221. if (--ln->nlmsvc_users == 0) {
  222. nlm_shutdown_hosts_net(net);
  223. cancel_delayed_work_sync(&ln->grace_period_end);
  224. locks_end_grace(&ln->lockd_manager);
  225. svc_shutdown_net(serv, net);
  226. dprintk("lockd_down_net: per-net data destroyed; net=%p\n", net);
  227. }
  228. } else {
  229. printk(KERN_ERR "lockd_down_net: no users! task=%p, net=%p\n",
  230. nlmsvc_task, net);
  231. BUG();
  232. }
  233. }
  234. static int lockd_start_svc(struct svc_serv *serv)
  235. {
  236. int error;
  237. if (nlmsvc_rqst)
  238. return 0;
  239. /*
  240. * Create the kernel thread and wait for it to start.
  241. */
  242. nlmsvc_rqst = svc_prepare_thread(serv, &serv->sv_pools[0], NUMA_NO_NODE);
  243. if (IS_ERR(nlmsvc_rqst)) {
  244. error = PTR_ERR(nlmsvc_rqst);
  245. printk(KERN_WARNING
  246. "lockd_up: svc_rqst allocation failed, error=%d\n",
  247. error);
  248. goto out_rqst;
  249. }
  250. svc_sock_update_bufs(serv);
  251. serv->sv_maxconn = nlm_max_connections;
  252. nlmsvc_task = kthread_create(lockd, nlmsvc_rqst, "%s", serv->sv_name);
  253. if (IS_ERR(nlmsvc_task)) {
  254. error = PTR_ERR(nlmsvc_task);
  255. printk(KERN_WARNING
  256. "lockd_up: kthread_run failed, error=%d\n", error);
  257. goto out_task;
  258. }
  259. nlmsvc_rqst->rq_task = nlmsvc_task;
  260. wake_up_process(nlmsvc_task);
  261. dprintk("lockd_up: service started\n");
  262. return 0;
  263. out_task:
  264. svc_exit_thread(nlmsvc_rqst);
  265. nlmsvc_task = NULL;
  266. out_rqst:
  267. nlmsvc_rqst = NULL;
  268. return error;
  269. }
  270. static struct svc_serv *lockd_create_svc(void)
  271. {
  272. struct svc_serv *serv;
  273. /*
  274. * Check whether we're already up and running.
  275. */
  276. if (nlmsvc_rqst) {
  277. /*
  278. * Note: increase service usage, because later in case of error
  279. * svc_destroy() will be called.
  280. */
  281. svc_get(nlmsvc_rqst->rq_server);
  282. return nlmsvc_rqst->rq_server;
  283. }
  284. /*
  285. * Sanity check: if there's no pid,
  286. * we should be the first user ...
  287. */
  288. if (nlmsvc_users)
  289. printk(KERN_WARNING
  290. "lockd_up: no pid, %d users??\n", nlmsvc_users);
  291. if (!nlm_timeout)
  292. nlm_timeout = LOCKD_DFLT_TIMEO;
  293. nlmsvc_timeout = nlm_timeout * HZ;
  294. serv = svc_create(&nlmsvc_program, LOCKD_BUFSIZE, svc_rpcb_cleanup);
  295. if (!serv) {
  296. printk(KERN_WARNING "lockd_up: create service failed\n");
  297. return ERR_PTR(-ENOMEM);
  298. }
  299. dprintk("lockd_up: service created\n");
  300. return serv;
  301. }
  302. /*
  303. * Bring up the lockd process if it's not already up.
  304. */
  305. int lockd_up(struct net *net)
  306. {
  307. struct svc_serv *serv;
  308. int error;
  309. mutex_lock(&nlmsvc_mutex);
  310. serv = lockd_create_svc();
  311. if (IS_ERR(serv)) {
  312. error = PTR_ERR(serv);
  313. goto err_create;
  314. }
  315. error = lockd_up_net(serv, net);
  316. if (error < 0)
  317. goto err_net;
  318. error = lockd_start_svc(serv);
  319. if (error < 0)
  320. goto err_start;
  321. nlmsvc_users++;
  322. /*
  323. * Note: svc_serv structures have an initial use count of 1,
  324. * so we exit through here on both success and failure.
  325. */
  326. err_net:
  327. svc_destroy(serv);
  328. err_create:
  329. mutex_unlock(&nlmsvc_mutex);
  330. return error;
  331. err_start:
  332. lockd_down_net(serv, net);
  333. goto err_net;
  334. }
  335. EXPORT_SYMBOL_GPL(lockd_up);
  336. /*
  337. * Decrement the user count and bring down lockd if we're the last.
  338. */
  339. void
  340. lockd_down(struct net *net)
  341. {
  342. mutex_lock(&nlmsvc_mutex);
  343. lockd_down_net(nlmsvc_rqst->rq_server, net);
  344. if (nlmsvc_users) {
  345. if (--nlmsvc_users)
  346. goto out;
  347. } else {
  348. printk(KERN_ERR "lockd_down: no users! task=%p\n",
  349. nlmsvc_task);
  350. BUG();
  351. }
  352. if (!nlmsvc_task) {
  353. printk(KERN_ERR "lockd_down: no lockd running.\n");
  354. BUG();
  355. }
  356. kthread_stop(nlmsvc_task);
  357. dprintk("lockd_down: service stopped\n");
  358. svc_exit_thread(nlmsvc_rqst);
  359. dprintk("lockd_down: service destroyed\n");
  360. nlmsvc_task = NULL;
  361. nlmsvc_rqst = NULL;
  362. out:
  363. mutex_unlock(&nlmsvc_mutex);
  364. }
  365. EXPORT_SYMBOL_GPL(lockd_down);
  366. #ifdef CONFIG_SYSCTL
  367. /*
  368. * Sysctl parameters (same as module parameters, different interface).
  369. */
  370. static struct ctl_table nlm_sysctls[] = {
  371. {
  372. .procname = "nlm_grace_period",
  373. .data = &nlm_grace_period,
  374. .maxlen = sizeof(unsigned long),
  375. .mode = 0644,
  376. .proc_handler = proc_doulongvec_minmax,
  377. .extra1 = (unsigned long *) &nlm_grace_period_min,
  378. .extra2 = (unsigned long *) &nlm_grace_period_max,
  379. },
  380. {
  381. .procname = "nlm_timeout",
  382. .data = &nlm_timeout,
  383. .maxlen = sizeof(unsigned long),
  384. .mode = 0644,
  385. .proc_handler = proc_doulongvec_minmax,
  386. .extra1 = (unsigned long *) &nlm_timeout_min,
  387. .extra2 = (unsigned long *) &nlm_timeout_max,
  388. },
  389. {
  390. .procname = "nlm_udpport",
  391. .data = &nlm_udpport,
  392. .maxlen = sizeof(int),
  393. .mode = 0644,
  394. .proc_handler = proc_dointvec_minmax,
  395. .extra1 = (int *) &nlm_port_min,
  396. .extra2 = (int *) &nlm_port_max,
  397. },
  398. {
  399. .procname = "nlm_tcpport",
  400. .data = &nlm_tcpport,
  401. .maxlen = sizeof(int),
  402. .mode = 0644,
  403. .proc_handler = proc_dointvec_minmax,
  404. .extra1 = (int *) &nlm_port_min,
  405. .extra2 = (int *) &nlm_port_max,
  406. },
  407. {
  408. .procname = "nsm_use_hostnames",
  409. .data = &nsm_use_hostnames,
  410. .maxlen = sizeof(int),
  411. .mode = 0644,
  412. .proc_handler = proc_dointvec,
  413. },
  414. {
  415. .procname = "nsm_local_state",
  416. .data = &nsm_local_state,
  417. .maxlen = sizeof(int),
  418. .mode = 0644,
  419. .proc_handler = proc_dointvec,
  420. },
  421. { }
  422. };
  423. static struct ctl_table nlm_sysctl_dir[] = {
  424. {
  425. .procname = "nfs",
  426. .mode = 0555,
  427. .child = nlm_sysctls,
  428. },
  429. { }
  430. };
  431. static struct ctl_table nlm_sysctl_root[] = {
  432. {
  433. .procname = "fs",
  434. .mode = 0555,
  435. .child = nlm_sysctl_dir,
  436. },
  437. { }
  438. };
  439. #endif /* CONFIG_SYSCTL */
  440. /*
  441. * Module (and sysfs) parameters.
  442. */
  443. #define param_set_min_max(name, type, which_strtol, min, max) \
  444. static int param_set_##name(const char *val, struct kernel_param *kp) \
  445. { \
  446. char *endp; \
  447. __typeof__(type) num = which_strtol(val, &endp, 0); \
  448. if (endp == val || *endp || num < (min) || num > (max)) \
  449. return -EINVAL; \
  450. *((type *) kp->arg) = num; \
  451. return 0; \
  452. }
  453. static inline int is_callback(u32 proc)
  454. {
  455. return proc == NLMPROC_GRANTED
  456. || proc == NLMPROC_GRANTED_MSG
  457. || proc == NLMPROC_TEST_RES
  458. || proc == NLMPROC_LOCK_RES
  459. || proc == NLMPROC_CANCEL_RES
  460. || proc == NLMPROC_UNLOCK_RES
  461. || proc == NLMPROC_NSM_NOTIFY;
  462. }
  463. static int lockd_authenticate(struct svc_rqst *rqstp)
  464. {
  465. rqstp->rq_client = NULL;
  466. switch (rqstp->rq_authop->flavour) {
  467. case RPC_AUTH_NULL:
  468. case RPC_AUTH_UNIX:
  469. if (rqstp->rq_proc == 0)
  470. return SVC_OK;
  471. if (is_callback(rqstp->rq_proc)) {
  472. /* Leave it to individual procedures to
  473. * call nlmsvc_lookup_host(rqstp)
  474. */
  475. return SVC_OK;
  476. }
  477. return svc_set_client(rqstp);
  478. }
  479. return SVC_DENIED;
  480. }
  481. param_set_min_max(port, int, simple_strtol, 0, 65535)
  482. param_set_min_max(grace_period, unsigned long, simple_strtoul,
  483. nlm_grace_period_min, nlm_grace_period_max)
  484. param_set_min_max(timeout, unsigned long, simple_strtoul,
  485. nlm_timeout_min, nlm_timeout_max)
  486. MODULE_AUTHOR("Olaf Kirch <okir@monad.swb.de>");
  487. MODULE_DESCRIPTION("NFS file locking service version " LOCKD_VERSION ".");
  488. MODULE_LICENSE("GPL");
  489. module_param_call(nlm_grace_period, param_set_grace_period, param_get_ulong,
  490. &nlm_grace_period, 0644);
  491. module_param_call(nlm_timeout, param_set_timeout, param_get_ulong,
  492. &nlm_timeout, 0644);
  493. module_param_call(nlm_udpport, param_set_port, param_get_int,
  494. &nlm_udpport, 0644);
  495. module_param_call(nlm_tcpport, param_set_port, param_get_int,
  496. &nlm_tcpport, 0644);
  497. module_param(nsm_use_hostnames, bool, 0644);
  498. module_param(nlm_max_connections, uint, 0644);
  499. static int lockd_init_net(struct net *net)
  500. {
  501. struct lockd_net *ln = net_generic(net, lockd_net_id);
  502. INIT_DELAYED_WORK(&ln->grace_period_end, grace_ender);
  503. INIT_LIST_HEAD(&ln->lockd_manager.list);
  504. spin_lock_init(&ln->nsm_clnt_lock);
  505. return 0;
  506. }
  507. static void lockd_exit_net(struct net *net)
  508. {
  509. }
  510. static struct pernet_operations lockd_net_ops = {
  511. .init = lockd_init_net,
  512. .exit = lockd_exit_net,
  513. .id = &lockd_net_id,
  514. .size = sizeof(struct lockd_net),
  515. };
  516. /*
  517. * Initialising and terminating the module.
  518. */
  519. static int __init init_nlm(void)
  520. {
  521. int err;
  522. #ifdef CONFIG_SYSCTL
  523. err = -ENOMEM;
  524. nlm_sysctl_table = register_sysctl_table(nlm_sysctl_root);
  525. if (nlm_sysctl_table == NULL)
  526. goto err_sysctl;
  527. #endif
  528. err = register_pernet_subsys(&lockd_net_ops);
  529. if (err)
  530. goto err_pernet;
  531. err = lockd_create_procfs();
  532. if (err)
  533. goto err_procfs;
  534. return 0;
  535. err_procfs:
  536. unregister_pernet_subsys(&lockd_net_ops);
  537. err_pernet:
  538. #ifdef CONFIG_SYSCTL
  539. unregister_sysctl_table(nlm_sysctl_table);
  540. err_sysctl:
  541. #endif
  542. return err;
  543. }
  544. static void __exit exit_nlm(void)
  545. {
  546. /* FIXME: delete all NLM clients */
  547. nlm_shutdown_hosts();
  548. lockd_remove_procfs();
  549. unregister_pernet_subsys(&lockd_net_ops);
  550. #ifdef CONFIG_SYSCTL
  551. unregister_sysctl_table(nlm_sysctl_table);
  552. #endif
  553. }
  554. module_init(init_nlm);
  555. module_exit(exit_nlm);
  556. /*
  557. * Define NLM program and procedures
  558. */
  559. static struct svc_version nlmsvc_version1 = {
  560. .vs_vers = 1,
  561. .vs_nproc = 17,
  562. .vs_proc = nlmsvc_procedures,
  563. .vs_xdrsize = NLMSVC_XDRSIZE,
  564. };
  565. static struct svc_version nlmsvc_version3 = {
  566. .vs_vers = 3,
  567. .vs_nproc = 24,
  568. .vs_proc = nlmsvc_procedures,
  569. .vs_xdrsize = NLMSVC_XDRSIZE,
  570. };
  571. #ifdef CONFIG_LOCKD_V4
  572. static struct svc_version nlmsvc_version4 = {
  573. .vs_vers = 4,
  574. .vs_nproc = 24,
  575. .vs_proc = nlmsvc_procedures4,
  576. .vs_xdrsize = NLMSVC_XDRSIZE,
  577. };
  578. #endif
  579. static struct svc_version * nlmsvc_version[] = {
  580. [1] = &nlmsvc_version1,
  581. [3] = &nlmsvc_version3,
  582. #ifdef CONFIG_LOCKD_V4
  583. [4] = &nlmsvc_version4,
  584. #endif
  585. };
  586. static struct svc_stat nlmsvc_stats;
  587. #define NLM_NRVERS ARRAY_SIZE(nlmsvc_version)
  588. static struct svc_program nlmsvc_program = {
  589. .pg_prog = NLM_PROGRAM, /* program number */
  590. .pg_nvers = NLM_NRVERS, /* number of entries in nlmsvc_version */
  591. .pg_vers = nlmsvc_version, /* version table */
  592. .pg_name = "lockd", /* service name */
  593. .pg_class = "nfsd", /* share authentication with nfsd */
  594. .pg_stats = &nlmsvc_stats, /* stats table */
  595. .pg_authenticate = &lockd_authenticate /* export authentication */
  596. };