• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asus-wl-520gu-7.0.1.45/src/linux/linux/fs/lockd/

Lines Matching refs:host

2  * linux/fs/lockd/host.c
59 * Match the given host against client/address
62 nlm_match_host(struct nlm_host *host, struct svc_client *clnt,
66 return host->h_exportent == clnt;
67 return nlm_cmp_addr(&host->h_addr, sin);
71 * Common host lookup routine for server & client
77 struct nlm_host *host, **hp;
100 for (hp = &nlm_hosts[hash]; (host = *hp); hp = &host->h_next) {
101 if (proto && host->h_proto != proto)
103 if (version && host->h_version != version)
106 if (nlm_match_host(host, clnt, sin)) {
108 *hp = host->h_next;
109 host->h_next = nlm_hosts[hash];
110 nlm_hosts[hash] = host;
112 nlm_get_host(host);
114 return host;
122 /* Ooops, no host found, create it */
123 dprintk("lockd: creating host entry\n");
125 if (!(host = (struct nlm_host *) kmalloc(sizeof(*host), GFP_KERNEL)))
127 memset(host, 0, sizeof(*host));
130 sprintf(host->h_name, "%d.%d.%d.%d",
136 host->h_addr = *sin;
137 host->h_addr.sin_port = 0; /* ouch! */
138 host->h_version = version;
139 host->h_proto = proto;
140 host->h_authflavor = RPC_AUTH_UNIX;
141 host->h_rpcclnt = NULL;
142 init_MUTEX(&host->h_sema);
143 host->h_nextrebind = jiffies + NLM_HOST_REBIND;
144 host->h_expires = jiffies + NLM_HOST_EXPIRE;
145 host->h_count = 1;
146 init_waitqueue_head(&host->h_gracewait);
147 host->h_state = 0; /* pseudo NSM state */
148 host->h_nsmstate = 0; /* real NSM state */
149 host->h_exportent = clnt;
151 host->h_next = nlm_hosts[hash];
152 nlm_hosts[hash] = host;
159 return host;
166 nlm_bind_host(struct nlm_host *host)
172 (unsigned)ntohl(host->h_addr.sin_addr.s_addr));
174 /* Lock host handle */
175 down(&host->h_sema);
181 if ((clnt = host->h_rpcclnt) != NULL) {
183 if (!xprt->stream && time_after_eq(jiffies, host->h_nextrebind)) {
185 host->h_nextrebind = jiffies + NLM_HOST_REBIND;
187 host->h_nextrebind - jiffies);
196 xprt = xprt_create_proto(host->h_proto, &host->h_addr, NULL);
204 clnt = rpc_create_client(xprt, host->h_name, &nlm_program,
205 host->h_version, host->h_authflavor);
213 host->h_rpcclnt = clnt;
216 up(&host->h_sema);
220 printk("lockd: couldn't create RPC handle for %s\n", host->h_name);
221 up(&host->h_sema);
229 nlm_rebind_host(struct nlm_host *host)
231 dprintk("lockd: rebind host %s\n", host->h_name);
232 if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) {
233 host->h_rpcclnt->cl_port = 0;
234 host->h_nextrebind = jiffies + NLM_HOST_REBIND;
239 * Increment NLM host count
241 struct nlm_host * nlm_get_host(struct nlm_host *host)
243 if (host) {
244 dprintk("lockd: get host %s\n", host->h_name);
245 host->h_count ++;
246 host->h_expires = jiffies + NLM_HOST_EXPIRE;
248 return host;
252 * Release NLM host after use
254 void nlm_release_host(struct nlm_host *host)
256 if (host && host->h_count) {
257 dprintk("lockd: release host %s\n", host->h_name);
258 host->h_count --;
269 struct nlm_host *host;
272 dprintk("lockd: shutting down host module\n");
278 for (host = nlm_hosts[i]; host; host = host->h_next)
279 host->h_expires = 0;
288 printk(KERN_WARNING "lockd: couldn't shutdown host module!\n");
291 for (host = nlm_hosts[i]; host; host = host->h_next) {
293 host->h_name, host->h_count,
294 host->h_inuse, host->h_expires);
308 struct nlm_host **q, *host;
312 dprintk("lockd: host garbage collection\n");
314 for (host = nlm_hosts[i]; host; host = host->h_next)
315 host->h_inuse = 0;
323 while ((host = *q) != NULL) {
324 if (host->h_count || host->h_inuse
325 || time_before(jiffies, host->h_expires)) {
326 q = &host->h_next;
329 dprintk("lockd: delete host %s\n", host->h_name);
330 *q = host->h_next;
332 if (host->h_monitored && !host->h_killed)
333 nsm_unmonitor(host);
334 if ((clnt = host->h_rpcclnt) != NULL) {
340 rpc_destroy_client(host->h_rpcclnt);
343 kfree(host);