]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - fs/lockd/mon.c
Merge tag 'mmc-v4.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc
[mirror_ubuntu-bionic-kernel.git] / fs / lockd / mon.c
CommitLineData
b2441318 1// SPDX-License-Identifier: GPL-2.0
1da177e4
LT
2/*
3 * linux/fs/lockd/mon.c
4 *
5 * The kernel statd client.
6 *
7 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
8 */
9
10#include <linux/types.h>
1da177e4 11#include <linux/kernel.h>
94da7663 12#include <linux/ktime.h>
5a0e3ad6 13#include <linux/slab.h>
94da7663 14
1da177e4 15#include <linux/sunrpc/clnt.h>
5976687a 16#include <linux/sunrpc/addr.h>
0896a725 17#include <linux/sunrpc/xprtsock.h>
1da177e4
LT
18#include <linux/sunrpc/svc.h>
19#include <linux/lockd/lockd.h>
1da177e4 20
ad5b365c
MR
21#include <asm/unaligned.h>
22
e9406db2
SK
23#include "netns.h"
24
1da177e4 25#define NLMDBG_FACILITY NLMDBG_MONITOR
36e8e668
CL
26#define NSM_PROGRAM 100024
27#define NSM_VERSION 1
28
29enum {
30 NSMPROC_NULL,
31 NSMPROC_STAT,
32 NSMPROC_MON,
33 NSMPROC_UNMON,
34 NSMPROC_UNMON_ALL,
35 NSMPROC_SIMU_CRASH,
36 NSMPROC_NOTIFY,
37};
1da177e4 38
9c1bfd03 39struct nsm_args {
cab2d3c9 40 struct nsm_private *priv;
9c1bfd03
CL
41 u32 prog; /* RPC callback info */
42 u32 vers;
43 u32 proc;
44
45 char *mon_name;
0d0f4aab 46 const char *nodename;
9c1bfd03
CL
47};
48
49struct nsm_res {
50 u32 status;
51 u32 state;
52};
53
a613fa16 54static const struct rpc_program nsm_program;
67c6d107 55static DEFINE_SPINLOCK(nsm_lock);
1da177e4
LT
56
57/*
58 * Local NSM state
59 */
6c9dc425 60u32 __read_mostly nsm_local_state;
90ab5ee9 61bool __read_mostly nsm_use_hostnames;
1da177e4 62
8529bc51
CL
63static inline struct sockaddr *nsm_addr(const struct nsm_handle *nsm)
64{
65 return (struct sockaddr *)&nsm->sm_addr;
66}
67
03a9a42a 68static struct rpc_clnt *nsm_create(struct net *net, const char *nodename)
49b5699b
CL
69{
70 struct sockaddr_in sin = {
71 .sin_family = AF_INET,
72 .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
73 };
74 struct rpc_create_args args = {
0e1cb5c0 75 .net = net,
e9406db2 76 .protocol = XPRT_TRANSPORT_TCP,
49b5699b
CL
77 .address = (struct sockaddr *)&sin,
78 .addrsize = sizeof(sin),
79 .servername = "rpc.statd",
03a9a42a 80 .nodename = nodename,
49b5699b
CL
81 .program = &nsm_program,
82 .version = NSM_VERSION,
83 .authflavor = RPC_AUTH_NULL,
0e5c2632 84 .flags = RPC_CLNT_CREATE_NOPING,
49b5699b
CL
85 };
86
87 return rpc_create(&args);
88}
89
0e1cb5c0 90static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res,
0d0f4aab 91 const struct nlm_host *host)
1da177e4 92{
1da177e4 93 int status;
0d0f4aab 94 struct rpc_clnt *clnt;
a4846750 95 struct nsm_args args = {
cab2d3c9 96 .priv = &nsm->sm_priv,
a4846750
CL
97 .prog = NLM_PROGRAM,
98 .vers = 3,
99 .proc = NLMPROC_NSM_NOTIFY,
29ed1407 100 .mon_name = nsm->sm_mon_name,
0d0f4aab 101 .nodename = host->nodename,
a4846750 102 };
dead28da
CL
103 struct rpc_message msg = {
104 .rpc_argp = &args,
105 .rpc_resp = res,
106 };
1da177e4 107
1da177e4
LT
108 memset(res, 0, sizeof(*res));
109
0d0f4aab
AR
110 clnt = nsm_create(host->net, host->nodename);
111 if (IS_ERR(clnt)) {
112 dprintk("lockd: failed to create NSM upcall transport, "
e919b076
VA
113 "status=%ld, net=%x\n", PTR_ERR(clnt),
114 host->net->ns.inum);
0d0f4aab
AR
115 return PTR_ERR(clnt);
116 }
117
dead28da 118 msg.rpc_proc = &clnt->cl_procinfo[proc];
e9406db2 119 status = rpc_call_sync(clnt, &msg, RPC_TASK_SOFTCONN);
173b3afc
BC
120 if (status == -ECONNREFUSED) {
121 dprintk("lockd: NSM upcall RPC failed, status=%d, forcing rebind\n",
122 status);
123 rpc_force_rebind(clnt);
124 status = rpc_call_sync(clnt, &msg, RPC_TASK_SOFTCONN);
125 }
1da177e4 126 if (status < 0)
5acf4315
CL
127 dprintk("lockd: NSM upcall RPC failed, status=%d\n",
128 status);
1da177e4
LT
129 else
130 status = 0;
0d0f4aab
AR
131
132 rpc_shutdown_client(clnt);
1da177e4
LT
133 return status;
134}
135
1e49323c
CL
136/**
137 * nsm_monitor - Notify a peer in case we reboot
138 * @host: pointer to nlm_host of peer to notify
139 *
140 * If this peer is not already monitored, this function sends an
141 * upcall to the local rpc.statd to record the name/address of
142 * the peer to notify in case we reboot.
143 *
144 * Returns zero if the peer is monitored by the local rpc.statd;
145 * otherwise a negative errno value is returned.
1da177e4 146 */
1e49323c 147int nsm_monitor(const struct nlm_host *host)
1da177e4 148{
8dead0db 149 struct nsm_handle *nsm = host->h_nsmhandle;
1da177e4
LT
150 struct nsm_res res;
151 int status;
152
9fee4902 153 dprintk("lockd: nsm_monitor(%s)\n", nsm->sm_name);
8dead0db
OK
154
155 if (nsm->sm_monitored)
977faf39 156 return 0;
1da177e4 157
29ed1407
CL
158 /*
159 * Choose whether to record the caller_name or IP address of
160 * this peer in the local rpc.statd's database.
161 */
162 nsm->sm_mon_name = nsm_use_hostnames ? nsm->sm_name : nsm->sm_addrbuf;
163
0d0f4aab 164 status = nsm_mon_unmon(nsm, NSMPROC_MON, &res, host);
6c9dc425 165 if (unlikely(res.status != 0))
5d254b11 166 status = -EIO;
6c9dc425 167 if (unlikely(status < 0)) {
9af94fc4 168 pr_notice_ratelimited("lockd: cannot monitor %s\n", nsm->sm_name);
6c9dc425
CL
169 return status;
170 }
171
172 nsm->sm_monitored = 1;
173 if (unlikely(nsm_local_state != res.state)) {
174 nsm_local_state = res.state;
175 dprintk("lockd: NSM state changed to %d\n", nsm_local_state);
176 }
177 return 0;
1da177e4
LT
178}
179
356c3eb4
CL
180/**
181 * nsm_unmonitor - Unregister peer notification
182 * @host: pointer to nlm_host of peer to stop monitoring
183 *
184 * If this peer is monitored, this function sends an upcall to
185 * tell the local rpc.statd not to send this peer a notification
186 * when we reboot.
1da177e4 187 */
356c3eb4 188void nsm_unmonitor(const struct nlm_host *host)
1da177e4 189{
8dead0db 190 struct nsm_handle *nsm = host->h_nsmhandle;
1da177e4 191 struct nsm_res res;
356c3eb4 192 int status;
1da177e4 193
9502c522
OK
194 if (atomic_read(&nsm->sm_count) == 1
195 && nsm->sm_monitored && !nsm->sm_sticky) {
9fee4902 196 dprintk("lockd: nsm_unmonitor(%s)\n", nsm->sm_name);
9502c522 197
0d0f4aab 198 status = nsm_mon_unmon(nsm, NSMPROC_UNMON, &res, host);
0c7aef45
CL
199 if (res.status != 0)
200 status = -EIO;
977faf39 201 if (status < 0)
9502c522 202 printk(KERN_NOTICE "lockd: cannot unmonitor %s\n",
9fee4902 203 nsm->sm_name);
9502c522
OK
204 else
205 nsm->sm_monitored = 0;
977faf39 206 }
1da177e4
LT
207}
208
0ad95472
AR
209static struct nsm_handle *nsm_lookup_hostname(const struct list_head *nsm_handles,
210 const char *hostname, const size_t len)
3420a8c4
CL
211{
212 struct nsm_handle *nsm;
213
0ad95472 214 list_for_each_entry(nsm, nsm_handles, sm_link)
3420a8c4
CL
215 if (strlen(nsm->sm_name) == len &&
216 memcmp(nsm->sm_name, hostname, len) == 0)
217 return nsm;
218 return NULL;
219}
220
0ad95472
AR
221static struct nsm_handle *nsm_lookup_addr(const struct list_head *nsm_handles,
222 const struct sockaddr *sap)
77a3ef33
CL
223{
224 struct nsm_handle *nsm;
225
0ad95472 226 list_for_each_entry(nsm, nsm_handles, sm_link)
4516fc04 227 if (rpc_cmp_addr(nsm_addr(nsm), sap))
77a3ef33
CL
228 return nsm;
229 return NULL;
230}
231
0ad95472
AR
232static struct nsm_handle *nsm_lookup_priv(const struct list_head *nsm_handles,
233 const struct nsm_private *priv)
3420a8c4
CL
234{
235 struct nsm_handle *nsm;
236
0ad95472 237 list_for_each_entry(nsm, nsm_handles, sm_link)
3420a8c4
CL
238 if (memcmp(nsm->sm_priv.data, priv->data,
239 sizeof(priv->data)) == 0)
240 return nsm;
241 return NULL;
242}
243
7e44d3be
CL
244/*
245 * Construct a unique cookie to match this nsm_handle to this monitored
246 * host. It is passed to the local rpc.statd via NSMPROC_MON, and
247 * returned via NLMPROC_SM_NOTIFY, in the "priv" field of these
248 * requests.
249 *
94da7663
CL
250 * The NSM protocol requires that these cookies be unique while the
251 * system is running. We prefer a stronger requirement of making them
252 * unique across reboots. If user space bugs cause a stale cookie to
253 * be sent to the kernel, it could cause the wrong host to lose its
254 * lock state if cookies were not unique across reboots.
255 *
256 * The cookies are exposed only to local user space via loopback. They
257 * do not appear on the physical network. If we want greater security
258 * for some reason, nsm_init_private() could perform a one-way hash to
259 * obscure the contents of the cookie.
7e44d3be
CL
260 */
261static void nsm_init_private(struct nsm_handle *nsm)
262{
94da7663 263 u64 *p = (u64 *)&nsm->sm_priv.data;
ad5b365c 264 s64 ns;
94da7663 265
5eaaed4f 266 ns = ktime_get_ns();
ad5b365c
MR
267 put_unaligned(ns, p);
268 put_unaligned((unsigned long)nsm, p + 1);
7e44d3be
CL
269}
270
b39b897c
CL
271static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap,
272 const size_t salen,
273 const char *hostname,
274 const size_t hostname_len)
275{
276 struct nsm_handle *new;
277
278 new = kzalloc(sizeof(*new) + hostname_len + 1, GFP_KERNEL);
279 if (unlikely(new == NULL))
280 return NULL;
281
282 atomic_set(&new->sm_count, 1);
283 new->sm_name = (char *)(new + 1);
284 memcpy(nsm_addr(new), sap, salen);
285 new->sm_addrlen = salen;
286 nsm_init_private(new);
c15128c5
CL
287
288 if (rpc_ntop(nsm_addr(new), new->sm_addrbuf,
289 sizeof(new->sm_addrbuf)) == 0)
290 (void)snprintf(new->sm_addrbuf, sizeof(new->sm_addrbuf),
291 "unsupported address family");
b39b897c
CL
292 memcpy(new->sm_name, hostname, hostname_len);
293 new->sm_name[hostname_len] = '\0';
294
295 return new;
296}
297
67c6d107 298/**
92fd91b9 299 * nsm_get_handle - Find or create a cached nsm_handle
0ad95472 300 * @net: network namespace
67c6d107
CL
301 * @sap: pointer to socket address of handle to find
302 * @salen: length of socket address
303 * @hostname: pointer to C string containing hostname to find
304 * @hostname_len: length of C string
67c6d107 305 *
92fd91b9 306 * Behavior is modulated by the global nsm_use_hostnames variable.
67c6d107 307 *
92fd91b9
CL
308 * Returns a cached nsm_handle after bumping its ref count, or
309 * returns a fresh nsm_handle if a handle that matches @sap and/or
310 * @hostname cannot be found in the handle cache. Returns NULL if
311 * an error occurs.
67c6d107 312 */
0ad95472
AR
313struct nsm_handle *nsm_get_handle(const struct net *net,
314 const struct sockaddr *sap,
92fd91b9
CL
315 const size_t salen, const char *hostname,
316 const size_t hostname_len)
67c6d107 317{
77a3ef33 318 struct nsm_handle *cached, *new = NULL;
0ad95472 319 struct lockd_net *ln = net_generic(net, lockd_net_id);
67c6d107 320
67c6d107
CL
321 if (hostname && memchr(hostname, '/', hostname_len) != NULL) {
322 if (printk_ratelimit()) {
323 printk(KERN_WARNING "Invalid hostname \"%.*s\" "
324 "in NFS lock request\n",
325 (int)hostname_len, hostname);
326 }
327 return NULL;
328 }
329
330retry:
331 spin_lock(&nsm_lock);
77a3ef33
CL
332
333 if (nsm_use_hostnames && hostname != NULL)
0ad95472
AR
334 cached = nsm_lookup_hostname(&ln->nsm_handles,
335 hostname, hostname_len);
77a3ef33 336 else
0ad95472 337 cached = nsm_lookup_addr(&ln->nsm_handles, sap);
77a3ef33
CL
338
339 if (cached != NULL) {
340 atomic_inc(&cached->sm_count);
341 spin_unlock(&nsm_lock);
342 kfree(new);
343 dprintk("lockd: found nsm_handle for %s (%s), "
344 "cnt %d\n", cached->sm_name,
345 cached->sm_addrbuf,
346 atomic_read(&cached->sm_count));
347 return cached;
67c6d107 348 }
77a3ef33
CL
349
350 if (new != NULL) {
0ad95472 351 list_add(&new->sm_link, &ln->nsm_handles);
77a3ef33 352 spin_unlock(&nsm_lock);
5cf1c4b1 353 dprintk("lockd: created nsm_handle for %s (%s)\n",
77a3ef33
CL
354 new->sm_name, new->sm_addrbuf);
355 return new;
67c6d107 356 }
77a3ef33 357
67c6d107
CL
358 spin_unlock(&nsm_lock);
359
77a3ef33
CL
360 new = nsm_create_handle(sap, salen, hostname, hostname_len);
361 if (unlikely(new == NULL))
67c6d107 362 return NULL;
67c6d107 363 goto retry;
67c6d107
CL
364}
365
3420a8c4
CL
366/**
367 * nsm_reboot_lookup - match NLMPROC_SM_NOTIFY arguments to an nsm_handle
0ad95472 368 * @net: network namespace
3420a8c4
CL
369 * @info: pointer to NLMPROC_SM_NOTIFY arguments
370 *
7e469af9
JL
371 * Returns a matching nsm_handle if found in the nsm cache. The returned
372 * nsm_handle's reference count is bumped. Otherwise returns NULL if some
373 * error occurred.
3420a8c4 374 */
0ad95472
AR
375struct nsm_handle *nsm_reboot_lookup(const struct net *net,
376 const struct nlm_reboot *info)
3420a8c4
CL
377{
378 struct nsm_handle *cached;
0ad95472 379 struct lockd_net *ln = net_generic(net, lockd_net_id);
3420a8c4
CL
380
381 spin_lock(&nsm_lock);
382
0ad95472 383 cached = nsm_lookup_priv(&ln->nsm_handles, &info->priv);
3420a8c4
CL
384 if (unlikely(cached == NULL)) {
385 spin_unlock(&nsm_lock);
386 dprintk("lockd: never saw rebooted peer '%.*s' before\n",
387 info->len, info->mon);
388 return cached;
389 }
390
391 atomic_inc(&cached->sm_count);
392 spin_unlock(&nsm_lock);
393
3420a8c4
CL
394 dprintk("lockd: host %s (%s) rebooted, cnt %d\n",
395 cached->sm_name, cached->sm_addrbuf,
396 atomic_read(&cached->sm_count));
397 return cached;
398}
399
67c6d107
CL
400/**
401 * nsm_release - Release an NSM handle
402 * @nsm: pointer to handle to be released
403 *
404 */
405void nsm_release(struct nsm_handle *nsm)
406{
67c6d107
CL
407 if (atomic_dec_and_lock(&nsm->sm_count, &nsm_lock)) {
408 list_del(&nsm->sm_link);
409 spin_unlock(&nsm_lock);
5cf1c4b1
CL
410 dprintk("lockd: destroyed nsm_handle for %s (%s)\n",
411 nsm->sm_name, nsm->sm_addrbuf);
67c6d107
CL
412 kfree(nsm);
413 }
414}
415
1da177e4
LT
416/*
417 * XDR functions for NSM.
2ca7754d
CL
418 *
419 * See http://www.opengroup.org/ for details on the Network
420 * Status Monitor wire protocol.
1da177e4
LT
421 */
422
49b17004 423static void encode_nsm_string(struct xdr_stream *xdr, const char *string)
099bd05f 424{
03eb1dcb
CL
425 const u32 len = strlen(string);
426 __be32 *p;
427
49b17004 428 p = xdr_reserve_space(xdr, 4 + len);
03eb1dcb 429 xdr_encode_opaque(p, string, len);
099bd05f
CL
430}
431
49695174
CL
432/*
433 * "mon_name" specifies the host to be monitored.
49695174 434 */
49b17004 435static void encode_mon_name(struct xdr_stream *xdr, const struct nsm_args *argp)
49695174 436{
49b17004 437 encode_nsm_string(xdr, argp->mon_name);
49695174
CL
438}
439
850c95fd
CL
440/*
441 * The "my_id" argument specifies the hostname and RPC procedure
442 * to be called when the status manager receives notification
36e8e668 443 * (via the NLMPROC_SM_NOTIFY call) that the state of host "mon_name"
850c95fd
CL
444 * has changed.
445 */
49b17004 446static void encode_my_id(struct xdr_stream *xdr, const struct nsm_args *argp)
850c95fd 447{
03eb1dcb
CL
448 __be32 *p;
449
303a7ce9 450 encode_nsm_string(xdr, argp->nodename);
49b17004
CL
451 p = xdr_reserve_space(xdr, 4 + 4 + 4);
452 *p++ = cpu_to_be32(argp->prog);
453 *p++ = cpu_to_be32(argp->vers);
454 *p = cpu_to_be32(argp->proc);
850c95fd
CL
455}
456
ea72a7f1
CL
457/*
458 * The "mon_id" argument specifies the non-private arguments
36e8e668 459 * of an NSMPROC_MON or NSMPROC_UNMON call.
ea72a7f1 460 */
49b17004 461static void encode_mon_id(struct xdr_stream *xdr, const struct nsm_args *argp)
ea72a7f1 462{
49b17004
CL
463 encode_mon_name(xdr, argp);
464 encode_my_id(xdr, argp);
ea72a7f1
CL
465}
466
0490a54a
CL
467/*
468 * The "priv" argument may contain private information required
36e8e668
CL
469 * by the NSMPROC_MON call. This information will be supplied in the
470 * NLMPROC_SM_NOTIFY call.
0490a54a 471 */
49b17004 472static void encode_priv(struct xdr_stream *xdr, const struct nsm_args *argp)
0490a54a 473{
03eb1dcb
CL
474 __be32 *p;
475
476 p = xdr_reserve_space(xdr, SM_PRIV_SIZE);
cab2d3c9 477 xdr_encode_opaque_fixed(p, argp->priv->data, SM_PRIV_SIZE);
0490a54a
CL
478}
479
9f06c719 480static void nsm_xdr_enc_mon(struct rpc_rqst *req, struct xdr_stream *xdr,
bf96391e 481 const void *argp)
1da177e4 482{
9f06c719
CL
483 encode_mon_id(xdr, argp);
484 encode_priv(xdr, argp);
1da177e4
LT
485}
486
9f06c719 487static void nsm_xdr_enc_unmon(struct rpc_rqst *req, struct xdr_stream *xdr,
bf96391e 488 const void *argp)
1da177e4 489{
9f06c719 490 encode_mon_id(xdr, argp);
1da177e4
LT
491}
492
bf269551
CL
493static int nsm_xdr_dec_stat_res(struct rpc_rqst *rqstp,
494 struct xdr_stream *xdr,
1fa23391 495 void *data)
1da177e4 496{
1fa23391 497 struct nsm_res *resp = data;
bf269551 498 __be32 *p;
03eb1dcb 499
bf269551 500 p = xdr_inline_decode(xdr, 4 + 4);
03eb1dcb
CL
501 if (unlikely(p == NULL))
502 return -EIO;
49b17004
CL
503 resp->status = be32_to_cpup(p++);
504 resp->state = be32_to_cpup(p);
03eb1dcb 505
bf269551
CL
506 dprintk("lockd: %s status %d state %d\n",
507 __func__, resp->status, resp->state);
1da177e4
LT
508 return 0;
509}
510
bf269551
CL
511static int nsm_xdr_dec_stat(struct rpc_rqst *rqstp,
512 struct xdr_stream *xdr,
1fa23391 513 void *data)
1da177e4 514{
1fa23391 515 struct nsm_res *resp = data;
bf269551 516 __be32 *p;
03eb1dcb 517
bf269551 518 p = xdr_inline_decode(xdr, 4);
03eb1dcb
CL
519 if (unlikely(p == NULL))
520 return -EIO;
49b17004 521 resp->state = be32_to_cpup(p);
03eb1dcb 522
bf269551 523 dprintk("lockd: %s state %d\n", __func__, resp->state);
1da177e4
LT
524 return 0;
525}
526
527#define SM_my_name_sz (1+XDR_QUADLEN(SM_MAXSTRLEN))
2ca7754d
CL
528#define SM_my_id_sz (SM_my_name_sz+3)
529#define SM_mon_name_sz (1+XDR_QUADLEN(SM_MAXSTRLEN))
530#define SM_mon_id_sz (SM_mon_name_sz+SM_my_id_sz)
0490a54a
CL
531#define SM_priv_sz (XDR_QUADLEN(SM_PRIV_SIZE))
532#define SM_mon_sz (SM_mon_id_sz+SM_priv_sz)
1da177e4
LT
533#define SM_monres_sz 2
534#define SM_unmonres_sz 1
535
499b4988 536static const struct rpc_procinfo nsm_procedures[] = {
36e8e668
CL
537[NSMPROC_MON] = {
538 .p_proc = NSMPROC_MON,
bf96391e 539 .p_encode = nsm_xdr_enc_mon,
1fa23391 540 .p_decode = nsm_xdr_dec_stat_res,
2bea90d4
CL
541 .p_arglen = SM_mon_sz,
542 .p_replen = SM_monres_sz,
36e8e668 543 .p_statidx = NSMPROC_MON,
cc0175c1 544 .p_name = "MONITOR",
1da177e4 545 },
36e8e668
CL
546[NSMPROC_UNMON] = {
547 .p_proc = NSMPROC_UNMON,
bf96391e 548 .p_encode = nsm_xdr_enc_unmon,
1fa23391 549 .p_decode = nsm_xdr_dec_stat,
2bea90d4
CL
550 .p_arglen = SM_mon_id_sz,
551 .p_replen = SM_unmonres_sz,
36e8e668 552 .p_statidx = NSMPROC_UNMON,
cc0175c1 553 .p_name = "UNMONITOR",
1da177e4
LT
554 },
555};
556
1c5876dd 557static unsigned int nsm_version1_counts[ARRAY_SIZE(nsm_procedures)];
a613fa16 558static const struct rpc_version nsm_version1 = {
cdfa31e9
CH
559 .number = 1,
560 .nrprocs = ARRAY_SIZE(nsm_procedures),
1c5876dd
CH
561 .procs = nsm_procedures,
562 .counts = nsm_version1_counts,
1da177e4
LT
563};
564
a613fa16 565static const struct rpc_version *nsm_version[] = {
1da177e4
LT
566 [1] = &nsm_version1,
567};
568
569static struct rpc_stat nsm_stats;
570
a613fa16 571static const struct rpc_program nsm_program = {
cdfa31e9
CH
572 .name = "statd",
573 .number = NSM_PROGRAM,
574 .nrvers = ARRAY_SIZE(nsm_version),
575 .version = nsm_version,
576 .stats = &nsm_stats
1da177e4 577};