Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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