xref: /openbmc/linux/fs/lockd/svc4proc.c (revision 6726d552)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * linux/fs/lockd/svc4proc.c
4  *
5  * Lockd server procedures. We don't implement the NLM_*_RES
6  * procedures because we don't use the async procedures.
7  *
8  * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
9  */
10 
11 #include <linux/types.h>
12 #include <linux/time.h>
13 #include <linux/lockd/lockd.h>
14 #include <linux/lockd/share.h>
15 #include <linux/sunrpc/svc_xprt.h>
16 
17 #define NLMDBG_FACILITY		NLMDBG_CLIENT
18 
19 /*
20  * Obtain client and file from arguments
21  */
22 static __be32
23 nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
24 			struct nlm_host **hostp, struct nlm_file **filp)
25 {
26 	struct nlm_host		*host = NULL;
27 	struct nlm_file		*file = NULL;
28 	struct nlm_lock		*lock = &argp->lock;
29 	__be32			error = 0;
30 
31 	/* nfsd callbacks must have been installed for this procedure */
32 	if (!nlmsvc_ops)
33 		return nlm_lck_denied_nolocks;
34 
35 	if (lock->lock_start > OFFSET_MAX ||
36 	    (lock->lock_len && ((lock->lock_len - 1) > (OFFSET_MAX - lock->lock_start))))
37 		return nlm4_fbig;
38 
39 	/* Obtain host handle */
40 	if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len))
41 	 || (argp->monitor && nsm_monitor(host) < 0))
42 		goto no_locks;
43 	*hostp = host;
44 
45 	/* Obtain file pointer. Not used by FREE_ALL call. */
46 	if (filp != NULL) {
47 		int mode = lock_to_openmode(&lock->fl);
48 
49 		error = nlm_lookup_file(rqstp, &file, lock);
50 		if (error)
51 			goto no_locks;
52 		*filp = file;
53 
54 		/* Set up the missing parts of the file_lock structure */
55 		lock->fl.fl_file  = file->f_file[mode];
56 		lock->fl.fl_pid = current->tgid;
57 		lock->fl.fl_start = (loff_t)lock->lock_start;
58 		lock->fl.fl_end = lock->lock_len ?
59 				   (loff_t)(lock->lock_start + lock->lock_len - 1) :
60 				   OFFSET_MAX;
61 		lock->fl.fl_lmops = &nlmsvc_lock_operations;
62 		nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
63 		if (!lock->fl.fl_owner) {
64 			/* lockowner allocation has failed */
65 			nlmsvc_release_host(host);
66 			return nlm_lck_denied_nolocks;
67 		}
68 	}
69 
70 	return 0;
71 
72 no_locks:
73 	nlmsvc_release_host(host);
74  	if (error)
75 		return error;
76 	return nlm_lck_denied_nolocks;
77 }
78 
79 /*
80  * NULL: Test for presence of service
81  */
82 static __be32
83 nlm4svc_proc_null(struct svc_rqst *rqstp)
84 {
85 	dprintk("lockd: NULL          called\n");
86 	return rpc_success;
87 }
88 
89 /*
90  * TEST: Check for conflicting lock
91  */
92 static __be32
93 __nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
94 {
95 	struct nlm_args *argp = rqstp->rq_argp;
96 	struct nlm_host	*host;
97 	struct nlm_file	*file;
98 	struct nlm_lockowner *test_owner;
99 	__be32 rc = rpc_success;
100 
101 	dprintk("lockd: TEST4        called\n");
102 	resp->cookie = argp->cookie;
103 
104 	/* Obtain client and file */
105 	if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
106 		return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
107 
108 	test_owner = argp->lock.fl.fl_owner;
109 	/* Now check for conflicting locks */
110 	resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie);
111 	if (resp->status == nlm_drop_reply)
112 		rc = rpc_drop_reply;
113 	else
114 		dprintk("lockd: TEST4        status %d\n", ntohl(resp->status));
115 
116 	nlmsvc_put_lockowner(test_owner);
117 	nlmsvc_release_host(host);
118 	nlm_release_file(file);
119 	return rc;
120 }
121 
122 static __be32
123 nlm4svc_proc_test(struct svc_rqst *rqstp)
124 {
125 	return __nlm4svc_proc_test(rqstp, rqstp->rq_resp);
126 }
127 
128 static __be32
129 __nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
130 {
131 	struct nlm_args *argp = rqstp->rq_argp;
132 	struct nlm_host	*host;
133 	struct nlm_file	*file;
134 	__be32 rc = rpc_success;
135 
136 	dprintk("lockd: LOCK          called\n");
137 
138 	resp->cookie = argp->cookie;
139 
140 	/* Obtain client and file */
141 	if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
142 		return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
143 
144 #if 0
145 	/* If supplied state doesn't match current state, we assume it's
146 	 * an old request that time-warped somehow. Any error return would
147 	 * do in this case because it's irrelevant anyway.
148 	 *
149 	 * NB: We don't retrieve the remote host's state yet.
150 	 */
151 	if (host->h_nsmstate && host->h_nsmstate != argp->state) {
152 		resp->status = nlm_lck_denied_nolocks;
153 	} else
154 #endif
155 
156 	/* Now try to lock the file */
157 	resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock,
158 					argp->block, &argp->cookie,
159 					argp->reclaim);
160 	if (resp->status == nlm_drop_reply)
161 		rc = rpc_drop_reply;
162 	else
163 		dprintk("lockd: LOCK         status %d\n", ntohl(resp->status));
164 
165 	nlmsvc_release_lockowner(&argp->lock);
166 	nlmsvc_release_host(host);
167 	nlm_release_file(file);
168 	return rc;
169 }
170 
171 static __be32
172 nlm4svc_proc_lock(struct svc_rqst *rqstp)
173 {
174 	return __nlm4svc_proc_lock(rqstp, rqstp->rq_resp);
175 }
176 
177 static __be32
178 __nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
179 {
180 	struct nlm_args *argp = rqstp->rq_argp;
181 	struct nlm_host	*host;
182 	struct nlm_file	*file;
183 
184 	dprintk("lockd: CANCEL        called\n");
185 
186 	resp->cookie = argp->cookie;
187 
188 	/* Don't accept requests during grace period */
189 	if (locks_in_grace(SVC_NET(rqstp))) {
190 		resp->status = nlm_lck_denied_grace_period;
191 		return rpc_success;
192 	}
193 
194 	/* Obtain client and file */
195 	if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
196 		return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
197 
198 	/* Try to cancel request. */
199 	resp->status = nlmsvc_cancel_blocked(SVC_NET(rqstp), file, &argp->lock);
200 
201 	dprintk("lockd: CANCEL        status %d\n", ntohl(resp->status));
202 	nlmsvc_release_lockowner(&argp->lock);
203 	nlmsvc_release_host(host);
204 	nlm_release_file(file);
205 	return rpc_success;
206 }
207 
208 static __be32
209 nlm4svc_proc_cancel(struct svc_rqst *rqstp)
210 {
211 	return __nlm4svc_proc_cancel(rqstp, rqstp->rq_resp);
212 }
213 
214 /*
215  * UNLOCK: release a lock
216  */
217 static __be32
218 __nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
219 {
220 	struct nlm_args *argp = rqstp->rq_argp;
221 	struct nlm_host	*host;
222 	struct nlm_file	*file;
223 
224 	dprintk("lockd: UNLOCK        called\n");
225 
226 	resp->cookie = argp->cookie;
227 
228 	/* Don't accept new lock requests during grace period */
229 	if (locks_in_grace(SVC_NET(rqstp))) {
230 		resp->status = nlm_lck_denied_grace_period;
231 		return rpc_success;
232 	}
233 
234 	/* Obtain client and file */
235 	if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
236 		return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
237 
238 	/* Now try to remove the lock */
239 	resp->status = nlmsvc_unlock(SVC_NET(rqstp), file, &argp->lock);
240 
241 	dprintk("lockd: UNLOCK        status %d\n", ntohl(resp->status));
242 	nlmsvc_release_lockowner(&argp->lock);
243 	nlmsvc_release_host(host);
244 	nlm_release_file(file);
245 	return rpc_success;
246 }
247 
248 static __be32
249 nlm4svc_proc_unlock(struct svc_rqst *rqstp)
250 {
251 	return __nlm4svc_proc_unlock(rqstp, rqstp->rq_resp);
252 }
253 
254 /*
255  * GRANTED: A server calls us to tell that a process' lock request
256  * was granted
257  */
258 static __be32
259 __nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
260 {
261 	struct nlm_args *argp = rqstp->rq_argp;
262 
263 	resp->cookie = argp->cookie;
264 
265 	dprintk("lockd: GRANTED       called\n");
266 	resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
267 	dprintk("lockd: GRANTED       status %d\n", ntohl(resp->status));
268 	return rpc_success;
269 }
270 
271 static __be32
272 nlm4svc_proc_granted(struct svc_rqst *rqstp)
273 {
274 	return __nlm4svc_proc_granted(rqstp, rqstp->rq_resp);
275 }
276 
277 /*
278  * This is the generic lockd callback for async RPC calls
279  */
280 static void nlm4svc_callback_exit(struct rpc_task *task, void *data)
281 {
282 }
283 
284 static void nlm4svc_callback_release(void *data)
285 {
286 	nlmsvc_release_call(data);
287 }
288 
289 static const struct rpc_call_ops nlm4svc_callback_ops = {
290 	.rpc_call_done = nlm4svc_callback_exit,
291 	.rpc_release = nlm4svc_callback_release,
292 };
293 
294 /*
295  * `Async' versions of the above service routines. They aren't really,
296  * because we send the callback before the reply proper. I hope this
297  * doesn't break any clients.
298  */
299 static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc,
300 		__be32 (*func)(struct svc_rqst *,  struct nlm_res *))
301 {
302 	struct nlm_args *argp = rqstp->rq_argp;
303 	struct nlm_host	*host;
304 	struct nlm_rqst	*call;
305 	__be32 stat;
306 
307 	host = nlmsvc_lookup_host(rqstp,
308 				  argp->lock.caller,
309 				  argp->lock.len);
310 	if (host == NULL)
311 		return rpc_system_err;
312 
313 	call = nlm_alloc_call(host);
314 	nlmsvc_release_host(host);
315 	if (call == NULL)
316 		return rpc_system_err;
317 
318 	stat = func(rqstp, &call->a_res);
319 	if (stat != 0) {
320 		nlmsvc_release_call(call);
321 		return stat;
322 	}
323 
324 	call->a_flags = RPC_TASK_ASYNC;
325 	if (nlm_async_reply(call, proc, &nlm4svc_callback_ops) < 0)
326 		return rpc_system_err;
327 	return rpc_success;
328 }
329 
330 static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp)
331 {
332 	dprintk("lockd: TEST_MSG      called\n");
333 	return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, __nlm4svc_proc_test);
334 }
335 
336 static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp)
337 {
338 	dprintk("lockd: LOCK_MSG      called\n");
339 	return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, __nlm4svc_proc_lock);
340 }
341 
342 static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp)
343 {
344 	dprintk("lockd: CANCEL_MSG    called\n");
345 	return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, __nlm4svc_proc_cancel);
346 }
347 
348 static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp)
349 {
350 	dprintk("lockd: UNLOCK_MSG    called\n");
351 	return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlm4svc_proc_unlock);
352 }
353 
354 static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp)
355 {
356 	dprintk("lockd: GRANTED_MSG   called\n");
357 	return nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, __nlm4svc_proc_granted);
358 }
359 
360 /*
361  * SHARE: create a DOS share or alter existing share.
362  */
363 static __be32
364 nlm4svc_proc_share(struct svc_rqst *rqstp)
365 {
366 	struct nlm_args *argp = rqstp->rq_argp;
367 	struct nlm_res *resp = rqstp->rq_resp;
368 	struct nlm_host	*host;
369 	struct nlm_file	*file;
370 
371 	dprintk("lockd: SHARE         called\n");
372 
373 	resp->cookie = argp->cookie;
374 
375 	/* Don't accept new lock requests during grace period */
376 	if (locks_in_grace(SVC_NET(rqstp)) && !argp->reclaim) {
377 		resp->status = nlm_lck_denied_grace_period;
378 		return rpc_success;
379 	}
380 
381 	/* Obtain client and file */
382 	if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
383 		return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
384 
385 	/* Now try to create the share */
386 	resp->status = nlmsvc_share_file(host, file, argp);
387 
388 	dprintk("lockd: SHARE         status %d\n", ntohl(resp->status));
389 	nlmsvc_release_lockowner(&argp->lock);
390 	nlmsvc_release_host(host);
391 	nlm_release_file(file);
392 	return rpc_success;
393 }
394 
395 /*
396  * UNSHARE: Release a DOS share.
397  */
398 static __be32
399 nlm4svc_proc_unshare(struct svc_rqst *rqstp)
400 {
401 	struct nlm_args *argp = rqstp->rq_argp;
402 	struct nlm_res *resp = rqstp->rq_resp;
403 	struct nlm_host	*host;
404 	struct nlm_file	*file;
405 
406 	dprintk("lockd: UNSHARE       called\n");
407 
408 	resp->cookie = argp->cookie;
409 
410 	/* Don't accept requests during grace period */
411 	if (locks_in_grace(SVC_NET(rqstp))) {
412 		resp->status = nlm_lck_denied_grace_period;
413 		return rpc_success;
414 	}
415 
416 	/* Obtain client and file */
417 	if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
418 		return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
419 
420 	/* Now try to lock the file */
421 	resp->status = nlmsvc_unshare_file(host, file, argp);
422 
423 	dprintk("lockd: UNSHARE       status %d\n", ntohl(resp->status));
424 	nlmsvc_release_lockowner(&argp->lock);
425 	nlmsvc_release_host(host);
426 	nlm_release_file(file);
427 	return rpc_success;
428 }
429 
430 /*
431  * NM_LOCK: Create an unmonitored lock
432  */
433 static __be32
434 nlm4svc_proc_nm_lock(struct svc_rqst *rqstp)
435 {
436 	struct nlm_args *argp = rqstp->rq_argp;
437 
438 	dprintk("lockd: NM_LOCK       called\n");
439 
440 	argp->monitor = 0;		/* just clean the monitor flag */
441 	return nlm4svc_proc_lock(rqstp);
442 }
443 
444 /*
445  * FREE_ALL: Release all locks and shares held by client
446  */
447 static __be32
448 nlm4svc_proc_free_all(struct svc_rqst *rqstp)
449 {
450 	struct nlm_args *argp = rqstp->rq_argp;
451 	struct nlm_host	*host;
452 
453 	/* Obtain client */
454 	if (nlm4svc_retrieve_args(rqstp, argp, &host, NULL))
455 		return rpc_success;
456 
457 	nlmsvc_free_host_resources(host);
458 	nlmsvc_release_host(host);
459 	return rpc_success;
460 }
461 
462 /*
463  * SM_NOTIFY: private callback from statd (not part of official NLM proto)
464  */
465 static __be32
466 nlm4svc_proc_sm_notify(struct svc_rqst *rqstp)
467 {
468 	struct nlm_reboot *argp = rqstp->rq_argp;
469 
470 	dprintk("lockd: SM_NOTIFY     called\n");
471 
472 	if (!nlm_privileged_requester(rqstp)) {
473 		char buf[RPC_MAX_ADDRBUFLEN];
474 		printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
475 				svc_print_addr(rqstp, buf, sizeof(buf)));
476 		return rpc_system_err;
477 	}
478 
479 	nlm_host_rebooted(SVC_NET(rqstp), argp);
480 	return rpc_success;
481 }
482 
483 /*
484  * client sent a GRANTED_RES, let's remove the associated block
485  */
486 static __be32
487 nlm4svc_proc_granted_res(struct svc_rqst *rqstp)
488 {
489 	struct nlm_res *argp = rqstp->rq_argp;
490 
491         if (!nlmsvc_ops)
492                 return rpc_success;
493 
494         dprintk("lockd: GRANTED_RES   called\n");
495 
496         nlmsvc_grant_reply(&argp->cookie, argp->status);
497         return rpc_success;
498 }
499 
500 static __be32
501 nlm4svc_proc_unused(struct svc_rqst *rqstp)
502 {
503 	return rpc_proc_unavail;
504 }
505 
506 
507 /*
508  * NLM Server procedures.
509  */
510 
511 struct nlm_void			{ int dummy; };
512 
513 #define	Ck	(1+XDR_QUADLEN(NLM_MAXCOOKIELEN))	/* cookie */
514 #define	No	(1+1024/4)				/* netobj */
515 #define	St	1					/* status */
516 #define	Rg	4					/* range (offset + length) */
517 
518 const struct svc_procedure nlmsvc_procedures4[24] = {
519 	[NLMPROC_NULL] = {
520 		.pc_func = nlm4svc_proc_null,
521 		.pc_decode = nlm4svc_decode_void,
522 		.pc_encode = nlm4svc_encode_void,
523 		.pc_argsize = sizeof(struct nlm_void),
524 		.pc_ressize = sizeof(struct nlm_void),
525 		.pc_xdrressize = St,
526 		.pc_name = "NULL",
527 	},
528 	[NLMPROC_TEST] = {
529 		.pc_func = nlm4svc_proc_test,
530 		.pc_decode = nlm4svc_decode_testargs,
531 		.pc_encode = nlm4svc_encode_testres,
532 		.pc_argsize = sizeof(struct nlm_args),
533 		.pc_ressize = sizeof(struct nlm_res),
534 		.pc_xdrressize = Ck+St+2+No+Rg,
535 		.pc_name = "TEST",
536 	},
537 	[NLMPROC_LOCK] = {
538 		.pc_func = nlm4svc_proc_lock,
539 		.pc_decode = nlm4svc_decode_lockargs,
540 		.pc_encode = nlm4svc_encode_res,
541 		.pc_argsize = sizeof(struct nlm_args),
542 		.pc_ressize = sizeof(struct nlm_res),
543 		.pc_xdrressize = Ck+St,
544 		.pc_name = "LOCK",
545 	},
546 	[NLMPROC_CANCEL] = {
547 		.pc_func = nlm4svc_proc_cancel,
548 		.pc_decode = nlm4svc_decode_cancargs,
549 		.pc_encode = nlm4svc_encode_res,
550 		.pc_argsize = sizeof(struct nlm_args),
551 		.pc_ressize = sizeof(struct nlm_res),
552 		.pc_xdrressize = Ck+St,
553 		.pc_name = "CANCEL",
554 	},
555 	[NLMPROC_UNLOCK] = {
556 		.pc_func = nlm4svc_proc_unlock,
557 		.pc_decode = nlm4svc_decode_unlockargs,
558 		.pc_encode = nlm4svc_encode_res,
559 		.pc_argsize = sizeof(struct nlm_args),
560 		.pc_ressize = sizeof(struct nlm_res),
561 		.pc_xdrressize = Ck+St,
562 		.pc_name = "UNLOCK",
563 	},
564 	[NLMPROC_GRANTED] = {
565 		.pc_func = nlm4svc_proc_granted,
566 		.pc_decode = nlm4svc_decode_testargs,
567 		.pc_encode = nlm4svc_encode_res,
568 		.pc_argsize = sizeof(struct nlm_args),
569 		.pc_ressize = sizeof(struct nlm_res),
570 		.pc_xdrressize = Ck+St,
571 		.pc_name = "GRANTED",
572 	},
573 	[NLMPROC_TEST_MSG] = {
574 		.pc_func = nlm4svc_proc_test_msg,
575 		.pc_decode = nlm4svc_decode_testargs,
576 		.pc_encode = nlm4svc_encode_void,
577 		.pc_argsize = sizeof(struct nlm_args),
578 		.pc_ressize = sizeof(struct nlm_void),
579 		.pc_xdrressize = St,
580 		.pc_name = "TEST_MSG",
581 	},
582 	[NLMPROC_LOCK_MSG] = {
583 		.pc_func = nlm4svc_proc_lock_msg,
584 		.pc_decode = nlm4svc_decode_lockargs,
585 		.pc_encode = nlm4svc_encode_void,
586 		.pc_argsize = sizeof(struct nlm_args),
587 		.pc_ressize = sizeof(struct nlm_void),
588 		.pc_xdrressize = St,
589 		.pc_name = "LOCK_MSG",
590 	},
591 	[NLMPROC_CANCEL_MSG] = {
592 		.pc_func = nlm4svc_proc_cancel_msg,
593 		.pc_decode = nlm4svc_decode_cancargs,
594 		.pc_encode = nlm4svc_encode_void,
595 		.pc_argsize = sizeof(struct nlm_args),
596 		.pc_ressize = sizeof(struct nlm_void),
597 		.pc_xdrressize = St,
598 		.pc_name = "CANCEL_MSG",
599 	},
600 	[NLMPROC_UNLOCK_MSG] = {
601 		.pc_func = nlm4svc_proc_unlock_msg,
602 		.pc_decode = nlm4svc_decode_unlockargs,
603 		.pc_encode = nlm4svc_encode_void,
604 		.pc_argsize = sizeof(struct nlm_args),
605 		.pc_ressize = sizeof(struct nlm_void),
606 		.pc_xdrressize = St,
607 		.pc_name = "UNLOCK_MSG",
608 	},
609 	[NLMPROC_GRANTED_MSG] = {
610 		.pc_func = nlm4svc_proc_granted_msg,
611 		.pc_decode = nlm4svc_decode_testargs,
612 		.pc_encode = nlm4svc_encode_void,
613 		.pc_argsize = sizeof(struct nlm_args),
614 		.pc_ressize = sizeof(struct nlm_void),
615 		.pc_xdrressize = St,
616 		.pc_name = "GRANTED_MSG",
617 	},
618 	[NLMPROC_TEST_RES] = {
619 		.pc_func = nlm4svc_proc_null,
620 		.pc_decode = nlm4svc_decode_void,
621 		.pc_encode = nlm4svc_encode_void,
622 		.pc_argsize = sizeof(struct nlm_res),
623 		.pc_ressize = sizeof(struct nlm_void),
624 		.pc_xdrressize = St,
625 		.pc_name = "TEST_RES",
626 	},
627 	[NLMPROC_LOCK_RES] = {
628 		.pc_func = nlm4svc_proc_null,
629 		.pc_decode = nlm4svc_decode_void,
630 		.pc_encode = nlm4svc_encode_void,
631 		.pc_argsize = sizeof(struct nlm_res),
632 		.pc_ressize = sizeof(struct nlm_void),
633 		.pc_xdrressize = St,
634 		.pc_name = "LOCK_RES",
635 	},
636 	[NLMPROC_CANCEL_RES] = {
637 		.pc_func = nlm4svc_proc_null,
638 		.pc_decode = nlm4svc_decode_void,
639 		.pc_encode = nlm4svc_encode_void,
640 		.pc_argsize = sizeof(struct nlm_res),
641 		.pc_ressize = sizeof(struct nlm_void),
642 		.pc_xdrressize = St,
643 		.pc_name = "CANCEL_RES",
644 	},
645 	[NLMPROC_UNLOCK_RES] = {
646 		.pc_func = nlm4svc_proc_null,
647 		.pc_decode = nlm4svc_decode_void,
648 		.pc_encode = nlm4svc_encode_void,
649 		.pc_argsize = sizeof(struct nlm_res),
650 		.pc_ressize = sizeof(struct nlm_void),
651 		.pc_xdrressize = St,
652 		.pc_name = "UNLOCK_RES",
653 	},
654 	[NLMPROC_GRANTED_RES] = {
655 		.pc_func = nlm4svc_proc_granted_res,
656 		.pc_decode = nlm4svc_decode_res,
657 		.pc_encode = nlm4svc_encode_void,
658 		.pc_argsize = sizeof(struct nlm_res),
659 		.pc_ressize = sizeof(struct nlm_void),
660 		.pc_xdrressize = St,
661 		.pc_name = "GRANTED_RES",
662 	},
663 	[NLMPROC_NSM_NOTIFY] = {
664 		.pc_func = nlm4svc_proc_sm_notify,
665 		.pc_decode = nlm4svc_decode_reboot,
666 		.pc_encode = nlm4svc_encode_void,
667 		.pc_argsize = sizeof(struct nlm_reboot),
668 		.pc_ressize = sizeof(struct nlm_void),
669 		.pc_xdrressize = St,
670 		.pc_name = "SM_NOTIFY",
671 	},
672 	[17] = {
673 		.pc_func = nlm4svc_proc_unused,
674 		.pc_decode = nlm4svc_decode_void,
675 		.pc_encode = nlm4svc_encode_void,
676 		.pc_argsize = sizeof(struct nlm_void),
677 		.pc_ressize = sizeof(struct nlm_void),
678 		.pc_xdrressize = 0,
679 		.pc_name = "UNUSED",
680 	},
681 	[18] = {
682 		.pc_func = nlm4svc_proc_unused,
683 		.pc_decode = nlm4svc_decode_void,
684 		.pc_encode = nlm4svc_encode_void,
685 		.pc_argsize = sizeof(struct nlm_void),
686 		.pc_ressize = sizeof(struct nlm_void),
687 		.pc_xdrressize = 0,
688 		.pc_name = "UNUSED",
689 	},
690 	[19] = {
691 		.pc_func = nlm4svc_proc_unused,
692 		.pc_decode = nlm4svc_decode_void,
693 		.pc_encode = nlm4svc_encode_void,
694 		.pc_argsize = sizeof(struct nlm_void),
695 		.pc_ressize = sizeof(struct nlm_void),
696 		.pc_xdrressize = 0,
697 		.pc_name = "UNUSED",
698 	},
699 	[NLMPROC_SHARE] = {
700 		.pc_func = nlm4svc_proc_share,
701 		.pc_decode = nlm4svc_decode_shareargs,
702 		.pc_encode = nlm4svc_encode_shareres,
703 		.pc_argsize = sizeof(struct nlm_args),
704 		.pc_ressize = sizeof(struct nlm_res),
705 		.pc_xdrressize = Ck+St+1,
706 		.pc_name = "SHARE",
707 	},
708 	[NLMPROC_UNSHARE] = {
709 		.pc_func = nlm4svc_proc_unshare,
710 		.pc_decode = nlm4svc_decode_shareargs,
711 		.pc_encode = nlm4svc_encode_shareres,
712 		.pc_argsize = sizeof(struct nlm_args),
713 		.pc_ressize = sizeof(struct nlm_res),
714 		.pc_xdrressize = Ck+St+1,
715 		.pc_name = "UNSHARE",
716 	},
717 	[NLMPROC_NM_LOCK] = {
718 		.pc_func = nlm4svc_proc_nm_lock,
719 		.pc_decode = nlm4svc_decode_lockargs,
720 		.pc_encode = nlm4svc_encode_res,
721 		.pc_argsize = sizeof(struct nlm_args),
722 		.pc_ressize = sizeof(struct nlm_res),
723 		.pc_xdrressize = Ck+St,
724 		.pc_name = "NM_LOCK",
725 	},
726 	[NLMPROC_FREE_ALL] = {
727 		.pc_func = nlm4svc_proc_free_all,
728 		.pc_decode = nlm4svc_decode_notify,
729 		.pc_encode = nlm4svc_encode_void,
730 		.pc_argsize = sizeof(struct nlm_args),
731 		.pc_ressize = sizeof(struct nlm_void),
732 		.pc_xdrressize = St,
733 		.pc_name = "FREE_ALL",
734 	},
735 };
736