コード例 #1
0
ファイル: svcproc.c プロジェクト: 3sOx/asuswrt-merlin
/*
 * FREE_ALL: Release all locks and shares held by client
 */
static __be32
nlmsvc_proc_free_all(struct svc_rqst *rqstp, struct nlm_args *argp,
					     void            *resp)
{
	struct nlm_host	*host;

	/* Obtain client */
	if (nlmsvc_retrieve_args(rqstp, argp, &host, NULL))
		return rpc_success;

	nlmsvc_free_host_resources(host);
	nlm_release_host(host);
	return rpc_success;
}
コード例 #2
0
ファイル: svc4proc.c プロジェクト: JBTech/ralink_rt5350
/*
 * SM_NOTIFY: private callback from statd (not part of official NLM proto)
 */
static int
nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
					      void	        *resp)
{
	struct sockaddr_in	saddr = rqstp->rq_addr;
	int			vers = rqstp->rq_vers;
	int			prot = rqstp->rq_prot;
	struct nlm_host		*host;

	dprintk("lockd: SM_NOTIFY     called\n");
	if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
	 || ntohs(saddr.sin_port) >= 1024) {
		printk(KERN_WARNING
			"lockd: rejected NSM callback from %08x:%d\n",
			ntohl(rqstp->rq_addr.sin_addr.s_addr),
			ntohs(rqstp->rq_addr.sin_port));
		return rpc_system_err;
	}

	/* Obtain the host pointer for this NFS server and try to
	 * reclaim all locks we hold on this server.
	 */
	saddr.sin_addr.s_addr = argp->addr;
	if ((host = nlmclnt_lookup_host(&saddr, prot, vers)) != NULL) {
		nlmclnt_recovery(host, argp->state);
		nlm_release_host(host);
	}

	/* If we run on an NFS server, delete all locks held by the client */
	if (nlmsvc_ops != NULL) {
		struct svc_client	*clnt;
		saddr.sin_addr.s_addr = argp->addr;
		if ((clnt = nlmsvc_ops->exp_getclient(&saddr)) != NULL 
		 && (host = nlm_lookup_host(clnt, &saddr, 0, 0)) != NULL) {
			nlmsvc_free_host_resources(host);
		}
		nlm_release_host(host);
	}

	return rpc_success;
}