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