1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds * linux/fs/lockd/svc4proc.c
41da177e4SLinus Torvalds *
51da177e4SLinus Torvalds * Lockd server procedures. We don't implement the NLM_*_RES
61da177e4SLinus Torvalds * procedures because we don't use the async procedures.
71da177e4SLinus Torvalds *
81da177e4SLinus Torvalds * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
91da177e4SLinus Torvalds */
101da177e4SLinus Torvalds
111da177e4SLinus Torvalds #include <linux/types.h>
121da177e4SLinus Torvalds #include <linux/time.h>
131da177e4SLinus Torvalds #include <linux/lockd/lockd.h>
141da177e4SLinus Torvalds #include <linux/lockd/share.h>
155ccb0066SStanislav Kinsbursky #include <linux/sunrpc/svc_xprt.h>
161da177e4SLinus Torvalds
171da177e4SLinus Torvalds #define NLMDBG_FACILITY NLMDBG_CLIENT
181da177e4SLinus Torvalds
191da177e4SLinus Torvalds /*
201da177e4SLinus Torvalds * Obtain client and file from arguments
211da177e4SLinus Torvalds */
2252921e02SAl Viro static __be32
nlm4svc_retrieve_args(struct svc_rqst * rqstp,struct nlm_args * argp,struct nlm_host ** hostp,struct nlm_file ** filp)231da177e4SLinus Torvalds nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
241da177e4SLinus Torvalds struct nlm_host **hostp, struct nlm_file **filp)
251da177e4SLinus Torvalds {
261da177e4SLinus Torvalds struct nlm_host *host = NULL;
271da177e4SLinus Torvalds struct nlm_file *file = NULL;
281da177e4SLinus Torvalds struct nlm_lock *lock = &argp->lock;
2952921e02SAl Viro __be32 error = 0;
301da177e4SLinus Torvalds
311da177e4SLinus Torvalds /* nfsd callbacks must have been installed for this procedure */
321da177e4SLinus Torvalds if (!nlmsvc_ops)
331da177e4SLinus Torvalds return nlm_lck_denied_nolocks;
341da177e4SLinus Torvalds
356930bcbfSJeff Layton if (lock->lock_start > OFFSET_MAX ||
366930bcbfSJeff Layton (lock->lock_len && ((lock->lock_len - 1) > (OFFSET_MAX - lock->lock_start))))
376930bcbfSJeff Layton return nlm4_fbig;
386930bcbfSJeff Layton
391da177e4SLinus Torvalds /* Obtain host handle */
40db4e4c9aSOlaf Kirch if (!(host = nlmsvc_lookup_host(rqstp, lock->caller, lock->len))
41977faf39SOlaf Kirch || (argp->monitor && nsm_monitor(host) < 0))
421da177e4SLinus Torvalds goto no_locks;
431da177e4SLinus Torvalds *hostp = host;
441da177e4SLinus Torvalds
451da177e4SLinus Torvalds /* Obtain file pointer. Not used by FREE_ALL call. */
461da177e4SLinus Torvalds if (filp != NULL) {
477f024fcdSJ. Bruce Fields int mode = lock_to_openmode(&lock->fl);
487f024fcdSJ. Bruce Fields
492dc6f19eSJ. Bruce Fields error = nlm_lookup_file(rqstp, &file, lock);
502dc6f19eSJ. Bruce Fields if (error)
511da177e4SLinus Torvalds goto no_locks;
521da177e4SLinus Torvalds *filp = file;
531da177e4SLinus Torvalds
541da177e4SLinus Torvalds /* Set up the missing parts of the file_lock structure */
55*75c7940dSJeff Layton lock->fl.fl_flags = FL_POSIX;
567f024fcdSJ. Bruce Fields lock->fl.fl_file = file->f_file[mode];
57646d73e9SBenjamin Coddington lock->fl.fl_pid = current->tgid;
586930bcbfSJeff Layton lock->fl.fl_start = (loff_t)lock->lock_start;
596930bcbfSJeff Layton lock->fl.fl_end = lock->lock_len ?
606930bcbfSJeff Layton (loff_t)(lock->lock_start + lock->lock_len - 1) :
616930bcbfSJeff Layton OFFSET_MAX;
621da177e4SLinus Torvalds lock->fl.fl_lmops = &nlmsvc_lock_operations;
6389e0edfbSBenjamin Coddington nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid);
6489e0edfbSBenjamin Coddington if (!lock->fl.fl_owner) {
6589e0edfbSBenjamin Coddington /* lockowner allocation has failed */
6689e0edfbSBenjamin Coddington nlmsvc_release_host(host);
6789e0edfbSBenjamin Coddington return nlm_lck_denied_nolocks;
6889e0edfbSBenjamin Coddington }
691da177e4SLinus Torvalds }
701da177e4SLinus Torvalds
711da177e4SLinus Torvalds return 0;
721da177e4SLinus Torvalds
731da177e4SLinus Torvalds no_locks:
7467216b94SChuck Lever nlmsvc_release_host(host);
751da177e4SLinus Torvalds if (error)
761da177e4SLinus Torvalds return error;
771da177e4SLinus Torvalds return nlm_lck_denied_nolocks;
781da177e4SLinus Torvalds }
791da177e4SLinus Torvalds
801da177e4SLinus Torvalds /*
811da177e4SLinus Torvalds * NULL: Test for presence of service
821da177e4SLinus Torvalds */
837111c66eSAl Viro static __be32
nlm4svc_proc_null(struct svc_rqst * rqstp)84a6beb732SChristoph Hellwig nlm4svc_proc_null(struct svc_rqst *rqstp)
851da177e4SLinus Torvalds {
861da177e4SLinus Torvalds dprintk("lockd: NULL called\n");
871da177e4SLinus Torvalds return rpc_success;
881da177e4SLinus Torvalds }
891da177e4SLinus Torvalds
901da177e4SLinus Torvalds /*
911da177e4SLinus Torvalds * TEST: Check for conflicting lock
921da177e4SLinus Torvalds */
937111c66eSAl Viro static __be32
__nlm4svc_proc_test(struct svc_rqst * rqstp,struct nlm_res * resp)94a6beb732SChristoph Hellwig __nlm4svc_proc_test(struct svc_rqst *rqstp, struct nlm_res *resp)
951da177e4SLinus Torvalds {
96a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
971da177e4SLinus Torvalds struct nlm_host *host;
981da177e4SLinus Torvalds struct nlm_file *file;
99184cefbeSBenjamin Coddington struct nlm_lockowner *test_owner;
100317602f3SHarvey Harrison __be32 rc = rpc_success;
1011da177e4SLinus Torvalds
1021da177e4SLinus Torvalds dprintk("lockd: TEST4 called\n");
1031da177e4SLinus Torvalds resp->cookie = argp->cookie;
1041da177e4SLinus Torvalds
1051da177e4SLinus Torvalds /* Obtain client and file */
1061da177e4SLinus Torvalds if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
107d343fce1SNeilBrown return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
1081da177e4SLinus Torvalds
109184cefbeSBenjamin Coddington test_owner = argp->lock.fl.fl_owner;
1101da177e4SLinus Torvalds /* Now check for conflicting locks */
1118f920d5eSJeff Layton resp->status = nlmsvc_testlock(rqstp, file, host, &argp->lock, &resp->lock, &resp->cookie);
1125ea0d750SMarc Eshel if (resp->status == nlm_drop_reply)
113b7e6b869SOleg Drokin rc = rpc_drop_reply;
114b7e6b869SOleg Drokin else
1151da177e4SLinus Torvalds dprintk("lockd: TEST4 status %d\n", ntohl(resp->status));
116b7e6b869SOleg Drokin
117184cefbeSBenjamin Coddington nlmsvc_put_lockowner(test_owner);
11867216b94SChuck Lever nlmsvc_release_host(host);
1191da177e4SLinus Torvalds nlm_release_file(file);
120b7e6b869SOleg Drokin return rc;
1211da177e4SLinus Torvalds }
1221da177e4SLinus Torvalds
1237111c66eSAl Viro static __be32
nlm4svc_proc_test(struct svc_rqst * rqstp)124a6beb732SChristoph Hellwig nlm4svc_proc_test(struct svc_rqst *rqstp)
1251da177e4SLinus Torvalds {
126a6beb732SChristoph Hellwig return __nlm4svc_proc_test(rqstp, rqstp->rq_resp);
127a6beb732SChristoph Hellwig }
128a6beb732SChristoph Hellwig
129a6beb732SChristoph Hellwig static __be32
__nlm4svc_proc_lock(struct svc_rqst * rqstp,struct nlm_res * resp)130a6beb732SChristoph Hellwig __nlm4svc_proc_lock(struct svc_rqst *rqstp, struct nlm_res *resp)
131a6beb732SChristoph Hellwig {
132a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
1331da177e4SLinus Torvalds struct nlm_host *host;
1341da177e4SLinus Torvalds struct nlm_file *file;
135317602f3SHarvey Harrison __be32 rc = rpc_success;
1361da177e4SLinus Torvalds
1371da177e4SLinus Torvalds dprintk("lockd: LOCK called\n");
1381da177e4SLinus Torvalds
1391da177e4SLinus Torvalds resp->cookie = argp->cookie;
1401da177e4SLinus Torvalds
1411da177e4SLinus Torvalds /* Obtain client and file */
1421da177e4SLinus Torvalds if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
143d343fce1SNeilBrown return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
1441da177e4SLinus Torvalds
1451da177e4SLinus Torvalds #if 0
1461da177e4SLinus Torvalds /* If supplied state doesn't match current state, we assume it's
1471da177e4SLinus Torvalds * an old request that time-warped somehow. Any error return would
1481da177e4SLinus Torvalds * do in this case because it's irrelevant anyway.
1491da177e4SLinus Torvalds *
1501da177e4SLinus Torvalds * NB: We don't retrieve the remote host's state yet.
1511da177e4SLinus Torvalds */
1521da177e4SLinus Torvalds if (host->h_nsmstate && host->h_nsmstate != argp->state) {
1531da177e4SLinus Torvalds resp->status = nlm_lck_denied_nolocks;
1541da177e4SLinus Torvalds } else
1551da177e4SLinus Torvalds #endif
1561da177e4SLinus Torvalds
1571da177e4SLinus Torvalds /* Now try to lock the file */
1586cde4de8SJeff Layton resp->status = nlmsvc_lock(rqstp, file, host, &argp->lock,
159b2b50289SJ. Bruce Fields argp->block, &argp->cookie,
160b2b50289SJ. Bruce Fields argp->reclaim);
1611a8322b2SMarc Eshel if (resp->status == nlm_drop_reply)
162b7e6b869SOleg Drokin rc = rpc_drop_reply;
163b7e6b869SOleg Drokin else
1641da177e4SLinus Torvalds dprintk("lockd: LOCK status %d\n", ntohl(resp->status));
165b7e6b869SOleg Drokin
16689e0edfbSBenjamin Coddington nlmsvc_release_lockowner(&argp->lock);
16767216b94SChuck Lever nlmsvc_release_host(host);
1681da177e4SLinus Torvalds nlm_release_file(file);
169b7e6b869SOleg Drokin return rc;
1701da177e4SLinus Torvalds }
1711da177e4SLinus Torvalds
1727111c66eSAl Viro static __be32
nlm4svc_proc_lock(struct svc_rqst * rqstp)173a6beb732SChristoph Hellwig nlm4svc_proc_lock(struct svc_rqst *rqstp)
1741da177e4SLinus Torvalds {
175a6beb732SChristoph Hellwig return __nlm4svc_proc_lock(rqstp, rqstp->rq_resp);
176a6beb732SChristoph Hellwig }
177a6beb732SChristoph Hellwig
178a6beb732SChristoph Hellwig static __be32
__nlm4svc_proc_cancel(struct svc_rqst * rqstp,struct nlm_res * resp)179a6beb732SChristoph Hellwig __nlm4svc_proc_cancel(struct svc_rqst *rqstp, struct nlm_res *resp)
180a6beb732SChristoph Hellwig {
181a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
1821da177e4SLinus Torvalds struct nlm_host *host;
1831da177e4SLinus Torvalds struct nlm_file *file;
1841da177e4SLinus Torvalds
1851da177e4SLinus Torvalds dprintk("lockd: CANCEL called\n");
1861da177e4SLinus Torvalds
1871da177e4SLinus Torvalds resp->cookie = argp->cookie;
1881da177e4SLinus Torvalds
1891da177e4SLinus Torvalds /* Don't accept requests during grace period */
1905ccb0066SStanislav Kinsbursky if (locks_in_grace(SVC_NET(rqstp))) {
1911da177e4SLinus Torvalds resp->status = nlm_lck_denied_grace_period;
1921da177e4SLinus Torvalds return rpc_success;
1931da177e4SLinus Torvalds }
1941da177e4SLinus Torvalds
1951da177e4SLinus Torvalds /* Obtain client and file */
1961da177e4SLinus Torvalds if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
197d343fce1SNeilBrown return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
1981da177e4SLinus Torvalds
1991da177e4SLinus Torvalds /* Try to cancel request. */
2005ccb0066SStanislav Kinsbursky resp->status = nlmsvc_cancel_blocked(SVC_NET(rqstp), file, &argp->lock);
2011da177e4SLinus Torvalds
2021da177e4SLinus Torvalds dprintk("lockd: CANCEL status %d\n", ntohl(resp->status));
20389e0edfbSBenjamin Coddington nlmsvc_release_lockowner(&argp->lock);
20467216b94SChuck Lever nlmsvc_release_host(host);
2051da177e4SLinus Torvalds nlm_release_file(file);
2061da177e4SLinus Torvalds return rpc_success;
2071da177e4SLinus Torvalds }
2081da177e4SLinus Torvalds
209a6beb732SChristoph Hellwig static __be32
nlm4svc_proc_cancel(struct svc_rqst * rqstp)210a6beb732SChristoph Hellwig nlm4svc_proc_cancel(struct svc_rqst *rqstp)
211a6beb732SChristoph Hellwig {
212a6beb732SChristoph Hellwig return __nlm4svc_proc_cancel(rqstp, rqstp->rq_resp);
213a6beb732SChristoph Hellwig }
214a6beb732SChristoph Hellwig
2151da177e4SLinus Torvalds /*
2161da177e4SLinus Torvalds * UNLOCK: release a lock
2171da177e4SLinus Torvalds */
2187111c66eSAl Viro static __be32
__nlm4svc_proc_unlock(struct svc_rqst * rqstp,struct nlm_res * resp)219a6beb732SChristoph Hellwig __nlm4svc_proc_unlock(struct svc_rqst *rqstp, struct nlm_res *resp)
2201da177e4SLinus Torvalds {
221a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
2221da177e4SLinus Torvalds struct nlm_host *host;
2231da177e4SLinus Torvalds struct nlm_file *file;
2241da177e4SLinus Torvalds
2251da177e4SLinus Torvalds dprintk("lockd: UNLOCK called\n");
2261da177e4SLinus Torvalds
2271da177e4SLinus Torvalds resp->cookie = argp->cookie;
2281da177e4SLinus Torvalds
2291da177e4SLinus Torvalds /* Don't accept new lock requests during grace period */
2305ccb0066SStanislav Kinsbursky if (locks_in_grace(SVC_NET(rqstp))) {
2311da177e4SLinus Torvalds resp->status = nlm_lck_denied_grace_period;
2321da177e4SLinus Torvalds return rpc_success;
2331da177e4SLinus Torvalds }
2341da177e4SLinus Torvalds
2351da177e4SLinus Torvalds /* Obtain client and file */
2361da177e4SLinus Torvalds if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
237d343fce1SNeilBrown return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
2381da177e4SLinus Torvalds
2391da177e4SLinus Torvalds /* Now try to remove the lock */
2405ccb0066SStanislav Kinsbursky resp->status = nlmsvc_unlock(SVC_NET(rqstp), file, &argp->lock);
2411da177e4SLinus Torvalds
2421da177e4SLinus Torvalds dprintk("lockd: UNLOCK status %d\n", ntohl(resp->status));
24389e0edfbSBenjamin Coddington nlmsvc_release_lockowner(&argp->lock);
24467216b94SChuck Lever nlmsvc_release_host(host);
2451da177e4SLinus Torvalds nlm_release_file(file);
2461da177e4SLinus Torvalds return rpc_success;
2471da177e4SLinus Torvalds }
2481da177e4SLinus Torvalds
249a6beb732SChristoph Hellwig static __be32
nlm4svc_proc_unlock(struct svc_rqst * rqstp)250a6beb732SChristoph Hellwig nlm4svc_proc_unlock(struct svc_rqst *rqstp)
251a6beb732SChristoph Hellwig {
252a6beb732SChristoph Hellwig return __nlm4svc_proc_unlock(rqstp, rqstp->rq_resp);
253a6beb732SChristoph Hellwig }
254a6beb732SChristoph Hellwig
2551da177e4SLinus Torvalds /*
2561da177e4SLinus Torvalds * GRANTED: A server calls us to tell that a process' lock request
2571da177e4SLinus Torvalds * was granted
2581da177e4SLinus Torvalds */
2597111c66eSAl Viro static __be32
__nlm4svc_proc_granted(struct svc_rqst * rqstp,struct nlm_res * resp)260a6beb732SChristoph Hellwig __nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_res *resp)
2611da177e4SLinus Torvalds {
262a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
263a6beb732SChristoph Hellwig
2641da177e4SLinus Torvalds resp->cookie = argp->cookie;
2651da177e4SLinus Torvalds
2661da177e4SLinus Torvalds dprintk("lockd: GRANTED called\n");
267dcff09f1SChuck Lever resp->status = nlmclnt_grant(svc_addr(rqstp), &argp->lock);
2681da177e4SLinus Torvalds dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
2691da177e4SLinus Torvalds return rpc_success;
2701da177e4SLinus Torvalds }
2711da177e4SLinus Torvalds
272a6beb732SChristoph Hellwig static __be32
nlm4svc_proc_granted(struct svc_rqst * rqstp)273a6beb732SChristoph Hellwig nlm4svc_proc_granted(struct svc_rqst *rqstp)
274a6beb732SChristoph Hellwig {
275a6beb732SChristoph Hellwig return __nlm4svc_proc_granted(rqstp, rqstp->rq_resp);
276a6beb732SChristoph Hellwig }
277a6beb732SChristoph Hellwig
2781da177e4SLinus Torvalds /*
279d4716624STrond Myklebust * This is the generic lockd callback for async RPC calls
280d4716624STrond Myklebust */
nlm4svc_callback_exit(struct rpc_task * task,void * data)281d4716624STrond Myklebust static void nlm4svc_callback_exit(struct rpc_task *task, void *data)
282d4716624STrond Myklebust {
283d4716624STrond Myklebust }
284d4716624STrond Myklebust
nlm4svc_callback_release(void * data)285d4716624STrond Myklebust static void nlm4svc_callback_release(void *data)
286d4716624STrond Myklebust {
2877db836d4SChuck Lever nlmsvc_release_call(data);
288d4716624STrond Myklebust }
289d4716624STrond Myklebust
290d4716624STrond Myklebust static const struct rpc_call_ops nlm4svc_callback_ops = {
291d4716624STrond Myklebust .rpc_call_done = nlm4svc_callback_exit,
292d4716624STrond Myklebust .rpc_release = nlm4svc_callback_release,
293d4716624STrond Myklebust };
294d4716624STrond Myklebust
295d4716624STrond Myklebust /*
2961da177e4SLinus Torvalds * `Async' versions of the above service routines. They aren't really,
2971da177e4SLinus Torvalds * because we send the callback before the reply proper. I hope this
2981da177e4SLinus Torvalds * doesn't break any clients.
2991da177e4SLinus Torvalds */
nlm4svc_callback(struct svc_rqst * rqstp,u32 proc,__be32 (* func)(struct svc_rqst *,struct nlm_res *))300a6beb732SChristoph Hellwig static __be32 nlm4svc_callback(struct svc_rqst *rqstp, u32 proc,
301a6beb732SChristoph Hellwig __be32 (*func)(struct svc_rqst *, struct nlm_res *))
302d4716624STrond Myklebust {
303a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
304d4716624STrond Myklebust struct nlm_host *host;
305d4716624STrond Myklebust struct nlm_rqst *call;
3067111c66eSAl Viro __be32 stat;
307d4716624STrond Myklebust
308db4e4c9aSOlaf Kirch host = nlmsvc_lookup_host(rqstp,
309db4e4c9aSOlaf Kirch argp->lock.caller,
310db4e4c9aSOlaf Kirch argp->lock.len);
311d4716624STrond Myklebust if (host == NULL)
312d4716624STrond Myklebust return rpc_system_err;
313d4716624STrond Myklebust
314d4716624STrond Myklebust call = nlm_alloc_call(host);
315446945abSAl Viro nlmsvc_release_host(host);
316d4716624STrond Myklebust if (call == NULL)
317d4716624STrond Myklebust return rpc_system_err;
318d4716624STrond Myklebust
319a6beb732SChristoph Hellwig stat = func(rqstp, &call->a_res);
320d4716624STrond Myklebust if (stat != 0) {
3217db836d4SChuck Lever nlmsvc_release_call(call);
322d4716624STrond Myklebust return stat;
323d4716624STrond Myklebust }
324d4716624STrond Myklebust
325d4716624STrond Myklebust call->a_flags = RPC_TASK_ASYNC;
326d4716624STrond Myklebust if (nlm_async_reply(call, proc, &nlm4svc_callback_ops) < 0)
327d4716624STrond Myklebust return rpc_system_err;
328d4716624STrond Myklebust return rpc_success;
329d4716624STrond Myklebust }
330d4716624STrond Myklebust
nlm4svc_proc_test_msg(struct svc_rqst * rqstp)331a6beb732SChristoph Hellwig static __be32 nlm4svc_proc_test_msg(struct svc_rqst *rqstp)
3321da177e4SLinus Torvalds {
3331da177e4SLinus Torvalds dprintk("lockd: TEST_MSG called\n");
334a6beb732SChristoph Hellwig return nlm4svc_callback(rqstp, NLMPROC_TEST_RES, __nlm4svc_proc_test);
3351da177e4SLinus Torvalds }
3361da177e4SLinus Torvalds
nlm4svc_proc_lock_msg(struct svc_rqst * rqstp)337a6beb732SChristoph Hellwig static __be32 nlm4svc_proc_lock_msg(struct svc_rqst *rqstp)
3381da177e4SLinus Torvalds {
3391da177e4SLinus Torvalds dprintk("lockd: LOCK_MSG called\n");
340a6beb732SChristoph Hellwig return nlm4svc_callback(rqstp, NLMPROC_LOCK_RES, __nlm4svc_proc_lock);
3411da177e4SLinus Torvalds }
3421da177e4SLinus Torvalds
nlm4svc_proc_cancel_msg(struct svc_rqst * rqstp)343a6beb732SChristoph Hellwig static __be32 nlm4svc_proc_cancel_msg(struct svc_rqst *rqstp)
3441da177e4SLinus Torvalds {
3451da177e4SLinus Torvalds dprintk("lockd: CANCEL_MSG called\n");
346a6beb732SChristoph Hellwig return nlm4svc_callback(rqstp, NLMPROC_CANCEL_RES, __nlm4svc_proc_cancel);
3471da177e4SLinus Torvalds }
3481da177e4SLinus Torvalds
nlm4svc_proc_unlock_msg(struct svc_rqst * rqstp)349a6beb732SChristoph Hellwig static __be32 nlm4svc_proc_unlock_msg(struct svc_rqst *rqstp)
3501da177e4SLinus Torvalds {
3511da177e4SLinus Torvalds dprintk("lockd: UNLOCK_MSG called\n");
352a6beb732SChristoph Hellwig return nlm4svc_callback(rqstp, NLMPROC_UNLOCK_RES, __nlm4svc_proc_unlock);
3531da177e4SLinus Torvalds }
3541da177e4SLinus Torvalds
nlm4svc_proc_granted_msg(struct svc_rqst * rqstp)355a6beb732SChristoph Hellwig static __be32 nlm4svc_proc_granted_msg(struct svc_rqst *rqstp)
3561da177e4SLinus Torvalds {
3571da177e4SLinus Torvalds dprintk("lockd: GRANTED_MSG called\n");
358a6beb732SChristoph Hellwig return nlm4svc_callback(rqstp, NLMPROC_GRANTED_RES, __nlm4svc_proc_granted);
3591da177e4SLinus Torvalds }
3601da177e4SLinus Torvalds
3611da177e4SLinus Torvalds /*
3621da177e4SLinus Torvalds * SHARE: create a DOS share or alter existing share.
3631da177e4SLinus Torvalds */
3647111c66eSAl Viro static __be32
nlm4svc_proc_share(struct svc_rqst * rqstp)365a6beb732SChristoph Hellwig nlm4svc_proc_share(struct svc_rqst *rqstp)
3661da177e4SLinus Torvalds {
367a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
368a6beb732SChristoph Hellwig struct nlm_res *resp = rqstp->rq_resp;
3691da177e4SLinus Torvalds struct nlm_host *host;
3701da177e4SLinus Torvalds struct nlm_file *file;
3711da177e4SLinus Torvalds
3721da177e4SLinus Torvalds dprintk("lockd: SHARE called\n");
3731da177e4SLinus Torvalds
3741da177e4SLinus Torvalds resp->cookie = argp->cookie;
3751da177e4SLinus Torvalds
3761da177e4SLinus Torvalds /* Don't accept new lock requests during grace period */
3775ccb0066SStanislav Kinsbursky if (locks_in_grace(SVC_NET(rqstp)) && !argp->reclaim) {
3781da177e4SLinus Torvalds resp->status = nlm_lck_denied_grace_period;
3791da177e4SLinus Torvalds return rpc_success;
3801da177e4SLinus Torvalds }
3811da177e4SLinus Torvalds
3821da177e4SLinus Torvalds /* Obtain client and file */
3831da177e4SLinus Torvalds if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
384d343fce1SNeilBrown return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
3851da177e4SLinus Torvalds
3861da177e4SLinus Torvalds /* Now try to create the share */
3871da177e4SLinus Torvalds resp->status = nlmsvc_share_file(host, file, argp);
3881da177e4SLinus Torvalds
3891da177e4SLinus Torvalds dprintk("lockd: SHARE status %d\n", ntohl(resp->status));
39089e0edfbSBenjamin Coddington nlmsvc_release_lockowner(&argp->lock);
39167216b94SChuck Lever nlmsvc_release_host(host);
3921da177e4SLinus Torvalds nlm_release_file(file);
3931da177e4SLinus Torvalds return rpc_success;
3941da177e4SLinus Torvalds }
3951da177e4SLinus Torvalds
3961da177e4SLinus Torvalds /*
3971da177e4SLinus Torvalds * UNSHARE: Release a DOS share.
3981da177e4SLinus Torvalds */
3997111c66eSAl Viro static __be32
nlm4svc_proc_unshare(struct svc_rqst * rqstp)400a6beb732SChristoph Hellwig nlm4svc_proc_unshare(struct svc_rqst *rqstp)
4011da177e4SLinus Torvalds {
402a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
403a6beb732SChristoph Hellwig struct nlm_res *resp = rqstp->rq_resp;
4041da177e4SLinus Torvalds struct nlm_host *host;
4051da177e4SLinus Torvalds struct nlm_file *file;
4061da177e4SLinus Torvalds
4071da177e4SLinus Torvalds dprintk("lockd: UNSHARE called\n");
4081da177e4SLinus Torvalds
4091da177e4SLinus Torvalds resp->cookie = argp->cookie;
4101da177e4SLinus Torvalds
4111da177e4SLinus Torvalds /* Don't accept requests during grace period */
4125ccb0066SStanislav Kinsbursky if (locks_in_grace(SVC_NET(rqstp))) {
4131da177e4SLinus Torvalds resp->status = nlm_lck_denied_grace_period;
4141da177e4SLinus Torvalds return rpc_success;
4151da177e4SLinus Torvalds }
4161da177e4SLinus Torvalds
4171da177e4SLinus Torvalds /* Obtain client and file */
4181da177e4SLinus Torvalds if ((resp->status = nlm4svc_retrieve_args(rqstp, argp, &host, &file)))
419d343fce1SNeilBrown return resp->status == nlm_drop_reply ? rpc_drop_reply :rpc_success;
4201da177e4SLinus Torvalds
4211da177e4SLinus Torvalds /* Now try to lock the file */
4221da177e4SLinus Torvalds resp->status = nlmsvc_unshare_file(host, file, argp);
4231da177e4SLinus Torvalds
4241da177e4SLinus Torvalds dprintk("lockd: UNSHARE status %d\n", ntohl(resp->status));
42589e0edfbSBenjamin Coddington nlmsvc_release_lockowner(&argp->lock);
42667216b94SChuck Lever nlmsvc_release_host(host);
4271da177e4SLinus Torvalds nlm_release_file(file);
4281da177e4SLinus Torvalds return rpc_success;
4291da177e4SLinus Torvalds }
4301da177e4SLinus Torvalds
4311da177e4SLinus Torvalds /*
4321da177e4SLinus Torvalds * NM_LOCK: Create an unmonitored lock
4331da177e4SLinus Torvalds */
4347111c66eSAl Viro static __be32
nlm4svc_proc_nm_lock(struct svc_rqst * rqstp)435a6beb732SChristoph Hellwig nlm4svc_proc_nm_lock(struct svc_rqst *rqstp)
4361da177e4SLinus Torvalds {
437a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
438a6beb732SChristoph Hellwig
4391da177e4SLinus Torvalds dprintk("lockd: NM_LOCK called\n");
4401da177e4SLinus Torvalds
4411da177e4SLinus Torvalds argp->monitor = 0; /* just clean the monitor flag */
442a6beb732SChristoph Hellwig return nlm4svc_proc_lock(rqstp);
4431da177e4SLinus Torvalds }
4441da177e4SLinus Torvalds
4451da177e4SLinus Torvalds /*
4461da177e4SLinus Torvalds * FREE_ALL: Release all locks and shares held by client
4471da177e4SLinus Torvalds */
4487111c66eSAl Viro static __be32
nlm4svc_proc_free_all(struct svc_rqst * rqstp)449a6beb732SChristoph Hellwig nlm4svc_proc_free_all(struct svc_rqst *rqstp)
4501da177e4SLinus Torvalds {
451a6beb732SChristoph Hellwig struct nlm_args *argp = rqstp->rq_argp;
4521da177e4SLinus Torvalds struct nlm_host *host;
4531da177e4SLinus Torvalds
4541da177e4SLinus Torvalds /* Obtain client */
4551da177e4SLinus Torvalds if (nlm4svc_retrieve_args(rqstp, argp, &host, NULL))
4561da177e4SLinus Torvalds return rpc_success;
4571da177e4SLinus Torvalds
4581da177e4SLinus Torvalds nlmsvc_free_host_resources(host);
45967216b94SChuck Lever nlmsvc_release_host(host);
4601da177e4SLinus Torvalds return rpc_success;
4611da177e4SLinus Torvalds }
4621da177e4SLinus Torvalds
4631da177e4SLinus Torvalds /*
4641da177e4SLinus Torvalds * SM_NOTIFY: private callback from statd (not part of official NLM proto)
4651da177e4SLinus Torvalds */
4667111c66eSAl Viro static __be32
nlm4svc_proc_sm_notify(struct svc_rqst * rqstp)467a6beb732SChristoph Hellwig nlm4svc_proc_sm_notify(struct svc_rqst *rqstp)
4681da177e4SLinus Torvalds {
469a6beb732SChristoph Hellwig struct nlm_reboot *argp = rqstp->rq_argp;
470a6beb732SChristoph Hellwig
4711da177e4SLinus Torvalds dprintk("lockd: SM_NOTIFY called\n");
472b85e4676SChuck Lever
473b85e4676SChuck Lever if (!nlm_privileged_requester(rqstp)) {
474ad06e4bdSChuck Lever char buf[RPC_MAX_ADDRBUFLEN];
475ad06e4bdSChuck Lever printk(KERN_WARNING "lockd: rejected NSM callback from %s\n",
476ad06e4bdSChuck Lever svc_print_addr(rqstp, buf, sizeof(buf)));
4771da177e4SLinus Torvalds return rpc_system_err;
4781da177e4SLinus Torvalds }
4791da177e4SLinus Torvalds
4800ad95472SAndrey Ryabinin nlm_host_rebooted(SVC_NET(rqstp), argp);
4811da177e4SLinus Torvalds return rpc_success;
4821da177e4SLinus Torvalds }
4831da177e4SLinus Torvalds
4841da177e4SLinus Torvalds /*
4851da177e4SLinus Torvalds * client sent a GRANTED_RES, let's remove the associated block
4861da177e4SLinus Torvalds */
4877111c66eSAl Viro static __be32
nlm4svc_proc_granted_res(struct svc_rqst * rqstp)488a6beb732SChristoph Hellwig nlm4svc_proc_granted_res(struct svc_rqst *rqstp)
4891da177e4SLinus Torvalds {
490a6beb732SChristoph Hellwig struct nlm_res *argp = rqstp->rq_argp;
491a6beb732SChristoph Hellwig
4921da177e4SLinus Torvalds if (!nlmsvc_ops)
4931da177e4SLinus Torvalds return rpc_success;
4941da177e4SLinus Torvalds
4951da177e4SLinus Torvalds dprintk("lockd: GRANTED_RES called\n");
4961da177e4SLinus Torvalds
49739be4502SOlaf Kirch nlmsvc_grant_reply(&argp->cookie, argp->status);
4981da177e4SLinus Torvalds return rpc_success;
4991da177e4SLinus Torvalds }
5001da177e4SLinus Torvalds
50149d99608SChuck Lever static __be32
nlm4svc_proc_unused(struct svc_rqst * rqstp)50249d99608SChuck Lever nlm4svc_proc_unused(struct svc_rqst *rqstp)
50349d99608SChuck Lever {
50449d99608SChuck Lever return rpc_proc_unavail;
50549d99608SChuck Lever }
50649d99608SChuck Lever
5071da177e4SLinus Torvalds
5081da177e4SLinus Torvalds /*
5091da177e4SLinus Torvalds * NLM Server procedures.
5101da177e4SLinus Torvalds */
5111da177e4SLinus Torvalds
5121da177e4SLinus Torvalds struct nlm_void { int dummy; };
5131da177e4SLinus Torvalds
5141da177e4SLinus Torvalds #define Ck (1+XDR_QUADLEN(NLM_MAXCOOKIELEN)) /* cookie */
5151da177e4SLinus Torvalds #define No (1+1024/4) /* netobj */
5161da177e4SLinus Torvalds #define St 1 /* status */
5171da177e4SLinus Torvalds #define Rg 4 /* range (offset + length) */
5181da177e4SLinus Torvalds
51949d99608SChuck Lever const struct svc_procedure nlmsvc_procedures4[24] = {
52049d99608SChuck Lever [NLMPROC_NULL] = {
52149d99608SChuck Lever .pc_func = nlm4svc_proc_null,
52249d99608SChuck Lever .pc_decode = nlm4svc_decode_void,
52349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
52449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_void),
525103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_void),
52649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
52749d99608SChuck Lever .pc_xdrressize = St,
5282289e87bSChuck Lever .pc_name = "NULL",
52949d99608SChuck Lever },
53049d99608SChuck Lever [NLMPROC_TEST] = {
53149d99608SChuck Lever .pc_func = nlm4svc_proc_test,
53249d99608SChuck Lever .pc_decode = nlm4svc_decode_testargs,
53349d99608SChuck Lever .pc_encode = nlm4svc_encode_testres,
53449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
535103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
53649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_res),
53749d99608SChuck Lever .pc_xdrressize = Ck+St+2+No+Rg,
5382289e87bSChuck Lever .pc_name = "TEST",
53949d99608SChuck Lever },
54049d99608SChuck Lever [NLMPROC_LOCK] = {
54149d99608SChuck Lever .pc_func = nlm4svc_proc_lock,
54249d99608SChuck Lever .pc_decode = nlm4svc_decode_lockargs,
54349d99608SChuck Lever .pc_encode = nlm4svc_encode_res,
54449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
545103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
54649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_res),
54749d99608SChuck Lever .pc_xdrressize = Ck+St,
5482289e87bSChuck Lever .pc_name = "LOCK",
54949d99608SChuck Lever },
55049d99608SChuck Lever [NLMPROC_CANCEL] = {
55149d99608SChuck Lever .pc_func = nlm4svc_proc_cancel,
55249d99608SChuck Lever .pc_decode = nlm4svc_decode_cancargs,
55349d99608SChuck Lever .pc_encode = nlm4svc_encode_res,
55449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
555103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
55649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_res),
55749d99608SChuck Lever .pc_xdrressize = Ck+St,
5582289e87bSChuck Lever .pc_name = "CANCEL",
55949d99608SChuck Lever },
56049d99608SChuck Lever [NLMPROC_UNLOCK] = {
56149d99608SChuck Lever .pc_func = nlm4svc_proc_unlock,
56249d99608SChuck Lever .pc_decode = nlm4svc_decode_unlockargs,
56349d99608SChuck Lever .pc_encode = nlm4svc_encode_res,
56449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
565103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
56649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_res),
56749d99608SChuck Lever .pc_xdrressize = Ck+St,
5682289e87bSChuck Lever .pc_name = "UNLOCK",
56949d99608SChuck Lever },
57049d99608SChuck Lever [NLMPROC_GRANTED] = {
57149d99608SChuck Lever .pc_func = nlm4svc_proc_granted,
57249d99608SChuck Lever .pc_decode = nlm4svc_decode_testargs,
57349d99608SChuck Lever .pc_encode = nlm4svc_encode_res,
57449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
575103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
57649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_res),
57749d99608SChuck Lever .pc_xdrressize = Ck+St,
5782289e87bSChuck Lever .pc_name = "GRANTED",
57949d99608SChuck Lever },
58049d99608SChuck Lever [NLMPROC_TEST_MSG] = {
58149d99608SChuck Lever .pc_func = nlm4svc_proc_test_msg,
58249d99608SChuck Lever .pc_decode = nlm4svc_decode_testargs,
58349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
58449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
585103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
58649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
58749d99608SChuck Lever .pc_xdrressize = St,
5882289e87bSChuck Lever .pc_name = "TEST_MSG",
58949d99608SChuck Lever },
59049d99608SChuck Lever [NLMPROC_LOCK_MSG] = {
59149d99608SChuck Lever .pc_func = nlm4svc_proc_lock_msg,
59249d99608SChuck Lever .pc_decode = nlm4svc_decode_lockargs,
59349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
59449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
595103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
59649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
59749d99608SChuck Lever .pc_xdrressize = St,
5982289e87bSChuck Lever .pc_name = "LOCK_MSG",
59949d99608SChuck Lever },
60049d99608SChuck Lever [NLMPROC_CANCEL_MSG] = {
60149d99608SChuck Lever .pc_func = nlm4svc_proc_cancel_msg,
60249d99608SChuck Lever .pc_decode = nlm4svc_decode_cancargs,
60349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
60449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
605103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
60649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
60749d99608SChuck Lever .pc_xdrressize = St,
6082289e87bSChuck Lever .pc_name = "CANCEL_MSG",
60949d99608SChuck Lever },
61049d99608SChuck Lever [NLMPROC_UNLOCK_MSG] = {
61149d99608SChuck Lever .pc_func = nlm4svc_proc_unlock_msg,
61249d99608SChuck Lever .pc_decode = nlm4svc_decode_unlockargs,
61349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
61449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
615103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
61649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
61749d99608SChuck Lever .pc_xdrressize = St,
6182289e87bSChuck Lever .pc_name = "UNLOCK_MSG",
61949d99608SChuck Lever },
62049d99608SChuck Lever [NLMPROC_GRANTED_MSG] = {
62149d99608SChuck Lever .pc_func = nlm4svc_proc_granted_msg,
62249d99608SChuck Lever .pc_decode = nlm4svc_decode_testargs,
62349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
62449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
625103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
62649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
62749d99608SChuck Lever .pc_xdrressize = St,
6282289e87bSChuck Lever .pc_name = "GRANTED_MSG",
62949d99608SChuck Lever },
63049d99608SChuck Lever [NLMPROC_TEST_RES] = {
63149d99608SChuck Lever .pc_func = nlm4svc_proc_null,
63249d99608SChuck Lever .pc_decode = nlm4svc_decode_void,
63349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
63449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_res),
635103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_res),
63649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
63749d99608SChuck Lever .pc_xdrressize = St,
6382289e87bSChuck Lever .pc_name = "TEST_RES",
63949d99608SChuck Lever },
64049d99608SChuck Lever [NLMPROC_LOCK_RES] = {
64149d99608SChuck Lever .pc_func = nlm4svc_proc_null,
64249d99608SChuck Lever .pc_decode = nlm4svc_decode_void,
64349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
64449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_res),
645103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_res),
64649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
64749d99608SChuck Lever .pc_xdrressize = St,
6482289e87bSChuck Lever .pc_name = "LOCK_RES",
64949d99608SChuck Lever },
65049d99608SChuck Lever [NLMPROC_CANCEL_RES] = {
65149d99608SChuck Lever .pc_func = nlm4svc_proc_null,
65249d99608SChuck Lever .pc_decode = nlm4svc_decode_void,
65349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
65449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_res),
655103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_res),
65649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
65749d99608SChuck Lever .pc_xdrressize = St,
6582289e87bSChuck Lever .pc_name = "CANCEL_RES",
65949d99608SChuck Lever },
66049d99608SChuck Lever [NLMPROC_UNLOCK_RES] = {
66149d99608SChuck Lever .pc_func = nlm4svc_proc_null,
66249d99608SChuck Lever .pc_decode = nlm4svc_decode_void,
66349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
66449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_res),
665103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_res),
66649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
66749d99608SChuck Lever .pc_xdrressize = St,
6682289e87bSChuck Lever .pc_name = "UNLOCK_RES",
66949d99608SChuck Lever },
67049d99608SChuck Lever [NLMPROC_GRANTED_RES] = {
67149d99608SChuck Lever .pc_func = nlm4svc_proc_granted_res,
67249d99608SChuck Lever .pc_decode = nlm4svc_decode_res,
67349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
67449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_res),
675103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_res),
67649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
67749d99608SChuck Lever .pc_xdrressize = St,
6782289e87bSChuck Lever .pc_name = "GRANTED_RES",
67949d99608SChuck Lever },
68049d99608SChuck Lever [NLMPROC_NSM_NOTIFY] = {
68149d99608SChuck Lever .pc_func = nlm4svc_proc_sm_notify,
68249d99608SChuck Lever .pc_decode = nlm4svc_decode_reboot,
68349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
68449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_reboot),
685103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_reboot),
68649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
68749d99608SChuck Lever .pc_xdrressize = St,
6882289e87bSChuck Lever .pc_name = "SM_NOTIFY",
68949d99608SChuck Lever },
69049d99608SChuck Lever [17] = {
69149d99608SChuck Lever .pc_func = nlm4svc_proc_unused,
69249d99608SChuck Lever .pc_decode = nlm4svc_decode_void,
69349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
69449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_void),
695103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_void),
69649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
69749d99608SChuck Lever .pc_xdrressize = 0,
6982289e87bSChuck Lever .pc_name = "UNUSED",
69949d99608SChuck Lever },
70049d99608SChuck Lever [18] = {
70149d99608SChuck Lever .pc_func = nlm4svc_proc_unused,
70249d99608SChuck Lever .pc_decode = nlm4svc_decode_void,
70349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
70449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_void),
705103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_void),
70649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
70749d99608SChuck Lever .pc_xdrressize = 0,
7082289e87bSChuck Lever .pc_name = "UNUSED",
70949d99608SChuck Lever },
71049d99608SChuck Lever [19] = {
71149d99608SChuck Lever .pc_func = nlm4svc_proc_unused,
71249d99608SChuck Lever .pc_decode = nlm4svc_decode_void,
71349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
71449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_void),
715103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_void),
71649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
71749d99608SChuck Lever .pc_xdrressize = 0,
7182289e87bSChuck Lever .pc_name = "UNUSED",
71949d99608SChuck Lever },
72049d99608SChuck Lever [NLMPROC_SHARE] = {
72149d99608SChuck Lever .pc_func = nlm4svc_proc_share,
72249d99608SChuck Lever .pc_decode = nlm4svc_decode_shareargs,
72349d99608SChuck Lever .pc_encode = nlm4svc_encode_shareres,
72449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
725103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
72649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_res),
72749d99608SChuck Lever .pc_xdrressize = Ck+St+1,
7282289e87bSChuck Lever .pc_name = "SHARE",
72949d99608SChuck Lever },
73049d99608SChuck Lever [NLMPROC_UNSHARE] = {
73149d99608SChuck Lever .pc_func = nlm4svc_proc_unshare,
73249d99608SChuck Lever .pc_decode = nlm4svc_decode_shareargs,
73349d99608SChuck Lever .pc_encode = nlm4svc_encode_shareres,
73449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
735103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
73649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_res),
73749d99608SChuck Lever .pc_xdrressize = Ck+St+1,
7382289e87bSChuck Lever .pc_name = "UNSHARE",
73949d99608SChuck Lever },
74049d99608SChuck Lever [NLMPROC_NM_LOCK] = {
74149d99608SChuck Lever .pc_func = nlm4svc_proc_nm_lock,
74249d99608SChuck Lever .pc_decode = nlm4svc_decode_lockargs,
74349d99608SChuck Lever .pc_encode = nlm4svc_encode_res,
74449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
745103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
74649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_res),
74749d99608SChuck Lever .pc_xdrressize = Ck+St,
7482289e87bSChuck Lever .pc_name = "NM_LOCK",
74949d99608SChuck Lever },
75049d99608SChuck Lever [NLMPROC_FREE_ALL] = {
75149d99608SChuck Lever .pc_func = nlm4svc_proc_free_all,
75249d99608SChuck Lever .pc_decode = nlm4svc_decode_notify,
75349d99608SChuck Lever .pc_encode = nlm4svc_encode_void,
75449d99608SChuck Lever .pc_argsize = sizeof(struct nlm_args),
755103cc1faSChuck Lever .pc_argzero = sizeof(struct nlm_args),
75649d99608SChuck Lever .pc_ressize = sizeof(struct nlm_void),
75749d99608SChuck Lever .pc_xdrressize = St,
7582289e87bSChuck Lever .pc_name = "FREE_ALL",
75949d99608SChuck Lever },
7601da177e4SLinus Torvalds };
761