Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/lockd/host.c |
| 3 | * |
| 4 | * Management for NLM peer hosts. The nlm_host struct is shared |
| 5 | * between client and server implementation. The only reason to |
| 6 | * do so is to reduce code bloat. |
| 7 | * |
| 8 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> |
| 9 | */ |
| 10 | |
| 11 | #include <linux/types.h> |
| 12 | #include <linux/sched.h> |
| 13 | #include <linux/slab.h> |
| 14 | #include <linux/in.h> |
| 15 | #include <linux/sunrpc/clnt.h> |
| 16 | #include <linux/sunrpc/svc.h> |
| 17 | #include <linux/lockd/lockd.h> |
| 18 | #include <linux/lockd/sm_inter.h> |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 19 | #include <linux/mutex.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | |
| 21 | |
| 22 | #define NLMDBG_FACILITY NLMDBG_HOSTCACHE |
| 23 | #define NLM_HOST_MAX 64 |
| 24 | #define NLM_HOST_NRHASH 32 |
| 25 | #define NLM_ADDRHASH(addr) (ntohl(addr) & (NLM_HOST_NRHASH-1)) |
| 26 | #define NLM_HOST_REBIND (60 * HZ) |
| 27 | #define NLM_HOST_EXPIRE ((nrhosts > NLM_HOST_MAX)? 300 * HZ : 120 * HZ) |
| 28 | #define NLM_HOST_COLLECT ((nrhosts > NLM_HOST_MAX)? 120 * HZ : 60 * HZ) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
| 30 | static struct nlm_host * nlm_hosts[NLM_HOST_NRHASH]; |
| 31 | static unsigned long next_gc; |
| 32 | static int nrhosts; |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 33 | static DEFINE_MUTEX(nlm_host_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
| 35 | |
| 36 | static void nlm_gc_hosts(void); |
| 37 | |
| 38 | /* |
| 39 | * Find an NLM server handle in the cache. If there is none, create it. |
| 40 | */ |
| 41 | struct nlm_host * |
Olaf Kirch | db4e4c9 | 2006-10-04 02:15:52 -0700 | [diff] [blame^] | 42 | nlmclnt_lookup_host(const struct sockaddr_in *sin, int proto, int version, |
| 43 | const char *hostname, int hostname_len) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | { |
Olaf Kirch | db4e4c9 | 2006-10-04 02:15:52 -0700 | [diff] [blame^] | 45 | return nlm_lookup_host(0, sin, proto, version, |
| 46 | hostname, hostname_len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | /* |
| 50 | * Find an NLM client handle in the cache. If there is none, create it. |
| 51 | */ |
| 52 | struct nlm_host * |
Olaf Kirch | db4e4c9 | 2006-10-04 02:15:52 -0700 | [diff] [blame^] | 53 | nlmsvc_lookup_host(struct svc_rqst *rqstp, |
| 54 | const char *hostname, int hostname_len) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | { |
| 56 | return nlm_lookup_host(1, &rqstp->rq_addr, |
Olaf Kirch | db4e4c9 | 2006-10-04 02:15:52 -0700 | [diff] [blame^] | 57 | rqstp->rq_prot, rqstp->rq_vers, |
| 58 | hostname, hostname_len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | /* |
| 62 | * Common host lookup routine for server & client |
| 63 | */ |
| 64 | struct nlm_host * |
Olaf Kirch | cf712c2 | 2006-10-04 02:15:52 -0700 | [diff] [blame] | 65 | nlm_lookup_host(int server, const struct sockaddr_in *sin, |
Olaf Kirch | db4e4c9 | 2006-10-04 02:15:52 -0700 | [diff] [blame^] | 66 | int proto, int version, |
| 67 | const char *hostname, |
| 68 | int hostname_len) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | { |
| 70 | struct nlm_host *host, **hp; |
| 71 | u32 addr; |
| 72 | int hash; |
| 73 | |
Olaf Kirch | db4e4c9 | 2006-10-04 02:15:52 -0700 | [diff] [blame^] | 74 | dprintk("lockd: nlm_lookup_host(%u.%u.%u.%u, p=%d, v=%d, my role=%s, name=%.*s)\n", |
| 75 | NIPQUAD(sin->sin_addr.s_addr), proto, version, |
| 76 | server? "server" : "client", |
| 77 | hostname_len, |
| 78 | hostname? hostname : "<none>"); |
| 79 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
| 81 | hash = NLM_ADDRHASH(sin->sin_addr.s_addr); |
| 82 | |
| 83 | /* Lock hash table */ |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 84 | mutex_lock(&nlm_host_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
| 86 | if (time_after_eq(jiffies, next_gc)) |
| 87 | nlm_gc_hosts(); |
| 88 | |
| 89 | for (hp = &nlm_hosts[hash]; (host = *hp) != 0; hp = &host->h_next) { |
| 90 | if (host->h_proto != proto) |
| 91 | continue; |
| 92 | if (host->h_version != version) |
| 93 | continue; |
| 94 | if (host->h_server != server) |
| 95 | continue; |
| 96 | |
| 97 | if (nlm_cmp_addr(&host->h_addr, sin)) { |
| 98 | if (hp != nlm_hosts + hash) { |
| 99 | *hp = host->h_next; |
| 100 | host->h_next = nlm_hosts[hash]; |
| 101 | nlm_hosts[hash] = host; |
| 102 | } |
| 103 | nlm_get_host(host); |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 104 | mutex_unlock(&nlm_host_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | return host; |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | /* Ooops, no host found, create it */ |
| 110 | dprintk("lockd: creating host entry\n"); |
| 111 | |
Panagiotis Issaris | f8314dc | 2006-09-27 01:49:37 -0700 | [diff] [blame] | 112 | host = kzalloc(sizeof(*host), GFP_KERNEL); |
| 113 | if (!host) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | goto nohost; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
| 116 | addr = sin->sin_addr.s_addr; |
| 117 | sprintf(host->h_name, "%u.%u.%u.%u", NIPQUAD(addr)); |
| 118 | |
| 119 | host->h_addr = *sin; |
| 120 | host->h_addr.sin_port = 0; /* ouch! */ |
| 121 | host->h_version = version; |
| 122 | host->h_proto = proto; |
| 123 | host->h_rpcclnt = NULL; |
Trond Myklebust | 5046791 | 2006-06-09 09:40:24 -0400 | [diff] [blame] | 124 | mutex_init(&host->h_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
| 126 | host->h_expires = jiffies + NLM_HOST_EXPIRE; |
| 127 | atomic_set(&host->h_count, 1); |
| 128 | init_waitqueue_head(&host->h_gracewait); |
Trond Myklebust | 28df955 | 2006-06-09 09:40:27 -0400 | [diff] [blame] | 129 | init_rwsem(&host->h_rwsem); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | host->h_state = 0; /* pseudo NSM state */ |
| 131 | host->h_nsmstate = 0; /* real NSM state */ |
| 132 | host->h_server = server; |
| 133 | host->h_next = nlm_hosts[hash]; |
| 134 | nlm_hosts[hash] = host; |
| 135 | INIT_LIST_HEAD(&host->h_lockowners); |
| 136 | spin_lock_init(&host->h_lock); |
Christoph Hellwig | 26bcbf9 | 2006-03-20 13:44:40 -0500 | [diff] [blame] | 137 | INIT_LIST_HEAD(&host->h_granted); |
| 138 | INIT_LIST_HEAD(&host->h_reclaim); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | |
| 140 | if (++nrhosts > NLM_HOST_MAX) |
| 141 | next_gc = 0; |
| 142 | |
| 143 | nohost: |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 144 | mutex_unlock(&nlm_host_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | return host; |
| 146 | } |
| 147 | |
| 148 | struct nlm_host * |
| 149 | nlm_find_client(void) |
| 150 | { |
| 151 | /* find a nlm_host for a client for which h_killed == 0. |
| 152 | * and return it |
| 153 | */ |
| 154 | int hash; |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 155 | mutex_lock(&nlm_host_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | for (hash = 0 ; hash < NLM_HOST_NRHASH; hash++) { |
| 157 | struct nlm_host *host, **hp; |
| 158 | for (hp = &nlm_hosts[hash]; (host = *hp) != 0; hp = &host->h_next) { |
| 159 | if (host->h_server && |
| 160 | host->h_killed == 0) { |
| 161 | nlm_get_host(host); |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 162 | mutex_unlock(&nlm_host_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | return host; |
| 164 | } |
| 165 | } |
| 166 | } |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 167 | mutex_unlock(&nlm_host_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | return NULL; |
| 169 | } |
| 170 | |
| 171 | |
| 172 | /* |
| 173 | * Create the NLM RPC client for an NLM peer |
| 174 | */ |
| 175 | struct rpc_clnt * |
| 176 | nlm_bind_host(struct nlm_host *host) |
| 177 | { |
| 178 | struct rpc_clnt *clnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | |
| 180 | dprintk("lockd: nlm_bind_host(%08x)\n", |
| 181 | (unsigned)ntohl(host->h_addr.sin_addr.s_addr)); |
| 182 | |
| 183 | /* Lock host handle */ |
Trond Myklebust | 5046791 | 2006-06-09 09:40:24 -0400 | [diff] [blame] | 184 | mutex_lock(&host->h_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | |
| 186 | /* If we've already created an RPC client, check whether |
| 187 | * RPC rebind is required |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | */ |
| 189 | if ((clnt = host->h_rpcclnt) != NULL) { |
Chuck Lever | 43118c2 | 2005-08-25 16:25:49 -0700 | [diff] [blame] | 190 | if (time_after_eq(jiffies, host->h_nextrebind)) { |
Chuck Lever | 35f5a42 | 2006-01-03 09:55:50 +0100 | [diff] [blame] | 191 | rpc_force_rebind(clnt); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
| 193 | dprintk("lockd: next rebind in %ld jiffies\n", |
| 194 | host->h_nextrebind - jiffies); |
| 195 | } |
| 196 | } else { |
Chuck Lever | e1ec789 | 2006-08-22 20:06:20 -0400 | [diff] [blame] | 197 | unsigned long increment = nlmsvc_timeout * HZ; |
| 198 | struct rpc_timeout timeparms = { |
| 199 | .to_initval = increment, |
| 200 | .to_increment = increment, |
| 201 | .to_maxval = increment * 6UL, |
| 202 | .to_retries = 5U, |
| 203 | }; |
| 204 | struct rpc_create_args args = { |
| 205 | .protocol = host->h_proto, |
| 206 | .address = (struct sockaddr *)&host->h_addr, |
| 207 | .addrsize = sizeof(host->h_addr), |
| 208 | .timeout = &timeparms, |
| 209 | .servername = host->h_name, |
| 210 | .program = &nlm_program, |
| 211 | .version = host->h_version, |
| 212 | .authflavor = RPC_AUTH_UNIX, |
| 213 | .flags = (RPC_CLNT_CREATE_HARDRTRY | |
| 214 | RPC_CLNT_CREATE_AUTOBIND), |
| 215 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 216 | |
Chuck Lever | e1ec789 | 2006-08-22 20:06:20 -0400 | [diff] [blame] | 217 | clnt = rpc_create(&args); |
| 218 | if (!IS_ERR(clnt)) |
| 219 | host->h_rpcclnt = clnt; |
| 220 | else { |
| 221 | printk("lockd: couldn't create RPC handle for %s\n", host->h_name); |
| 222 | clnt = NULL; |
| 223 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | } |
| 225 | |
Trond Myklebust | 5046791 | 2006-06-09 09:40:24 -0400 | [diff] [blame] | 226 | mutex_unlock(&host->h_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | return clnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | /* |
| 231 | * Force a portmap lookup of the remote lockd port |
| 232 | */ |
| 233 | void |
| 234 | nlm_rebind_host(struct nlm_host *host) |
| 235 | { |
| 236 | dprintk("lockd: rebind host %s\n", host->h_name); |
| 237 | if (host->h_rpcclnt && time_after_eq(jiffies, host->h_nextrebind)) { |
Chuck Lever | 35f5a42 | 2006-01-03 09:55:50 +0100 | [diff] [blame] | 238 | rpc_force_rebind(host->h_rpcclnt); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | host->h_nextrebind = jiffies + NLM_HOST_REBIND; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | /* |
| 244 | * Increment NLM host count |
| 245 | */ |
| 246 | struct nlm_host * nlm_get_host(struct nlm_host *host) |
| 247 | { |
| 248 | if (host) { |
| 249 | dprintk("lockd: get host %s\n", host->h_name); |
| 250 | atomic_inc(&host->h_count); |
| 251 | host->h_expires = jiffies + NLM_HOST_EXPIRE; |
| 252 | } |
| 253 | return host; |
| 254 | } |
| 255 | |
| 256 | /* |
| 257 | * Release NLM host after use |
| 258 | */ |
| 259 | void nlm_release_host(struct nlm_host *host) |
| 260 | { |
| 261 | if (host != NULL) { |
| 262 | dprintk("lockd: release host %s\n", host->h_name); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | BUG_ON(atomic_read(&host->h_count) < 0); |
Trond Myklebust | 4c060b5 | 2006-03-20 13:44:41 -0500 | [diff] [blame] | 264 | if (atomic_dec_and_test(&host->h_count)) { |
| 265 | BUG_ON(!list_empty(&host->h_lockowners)); |
| 266 | BUG_ON(!list_empty(&host->h_granted)); |
| 267 | BUG_ON(!list_empty(&host->h_reclaim)); |
| 268 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | } |
| 270 | } |
| 271 | |
| 272 | /* |
Olaf Kirch | cf712c2 | 2006-10-04 02:15:52 -0700 | [diff] [blame] | 273 | * We were notified that the host indicated by address &sin |
| 274 | * has rebooted. |
| 275 | * Release all resources held by that peer. |
| 276 | */ |
| 277 | void nlm_host_rebooted(const struct sockaddr_in *sin, const struct nlm_reboot *argp) |
| 278 | { |
| 279 | struct nlm_host *host; |
Olaf Kirch | db4e4c9 | 2006-10-04 02:15:52 -0700 | [diff] [blame^] | 280 | int server; |
Olaf Kirch | cf712c2 | 2006-10-04 02:15:52 -0700 | [diff] [blame] | 281 | |
| 282 | /* Obtain the host pointer for this NFS server and try to |
| 283 | * reclaim all locks we hold on this server. |
| 284 | */ |
Olaf Kirch | db4e4c9 | 2006-10-04 02:15:52 -0700 | [diff] [blame^] | 285 | server = (argp->proto & 1)? 1 : 0; |
| 286 | host = nlm_lookup_host(server, sin, argp->proto >> 1, argp->vers, |
| 287 | argp->mon, argp->len); |
| 288 | if (host == NULL) |
| 289 | return; |
| 290 | |
| 291 | if (server == 0) { |
Olaf Kirch | cf712c2 | 2006-10-04 02:15:52 -0700 | [diff] [blame] | 292 | /* We are client, he's the server: try to reclaim all locks. */ |
Olaf Kirch | cf712c2 | 2006-10-04 02:15:52 -0700 | [diff] [blame] | 293 | nlmclnt_recovery(host, argp->state); |
| 294 | } else { |
| 295 | /* He's the client, we're the server: delete all locks held by the client */ |
Olaf Kirch | cf712c2 | 2006-10-04 02:15:52 -0700 | [diff] [blame] | 296 | nlmsvc_free_host_resources(host); |
| 297 | } |
| 298 | nlm_release_host(host); |
| 299 | } |
| 300 | |
| 301 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | * Shut down the hosts module. |
| 303 | * Note that this routine is called only at server shutdown time. |
| 304 | */ |
| 305 | void |
| 306 | nlm_shutdown_hosts(void) |
| 307 | { |
| 308 | struct nlm_host *host; |
| 309 | int i; |
| 310 | |
| 311 | dprintk("lockd: shutting down host module\n"); |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 312 | mutex_lock(&nlm_host_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
| 314 | /* First, make all hosts eligible for gc */ |
| 315 | dprintk("lockd: nuking all hosts...\n"); |
| 316 | for (i = 0; i < NLM_HOST_NRHASH; i++) { |
| 317 | for (host = nlm_hosts[i]; host; host = host->h_next) |
| 318 | host->h_expires = jiffies - 1; |
| 319 | } |
| 320 | |
| 321 | /* Then, perform a garbage collection pass */ |
| 322 | nlm_gc_hosts(); |
Ingo Molnar | 353ab6e | 2006-03-26 01:37:12 -0800 | [diff] [blame] | 323 | mutex_unlock(&nlm_host_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | |
| 325 | /* complain if any hosts are left */ |
| 326 | if (nrhosts) { |
| 327 | printk(KERN_WARNING "lockd: couldn't shutdown host module!\n"); |
| 328 | dprintk("lockd: %d hosts left:\n", nrhosts); |
| 329 | for (i = 0; i < NLM_HOST_NRHASH; i++) { |
| 330 | for (host = nlm_hosts[i]; host; host = host->h_next) { |
| 331 | dprintk(" %s (cnt %d use %d exp %ld)\n", |
| 332 | host->h_name, atomic_read(&host->h_count), |
| 333 | host->h_inuse, host->h_expires); |
| 334 | } |
| 335 | } |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | /* |
| 340 | * Garbage collect any unused NLM hosts. |
| 341 | * This GC combines reference counting for async operations with |
| 342 | * mark & sweep for resources held by remote clients. |
| 343 | */ |
| 344 | static void |
| 345 | nlm_gc_hosts(void) |
| 346 | { |
| 347 | struct nlm_host **q, *host; |
| 348 | struct rpc_clnt *clnt; |
| 349 | int i; |
| 350 | |
| 351 | dprintk("lockd: host garbage collection\n"); |
| 352 | for (i = 0; i < NLM_HOST_NRHASH; i++) { |
| 353 | for (host = nlm_hosts[i]; host; host = host->h_next) |
| 354 | host->h_inuse = 0; |
| 355 | } |
| 356 | |
| 357 | /* Mark all hosts that hold locks, blocks or shares */ |
| 358 | nlmsvc_mark_resources(); |
| 359 | |
| 360 | for (i = 0; i < NLM_HOST_NRHASH; i++) { |
| 361 | q = &nlm_hosts[i]; |
| 362 | while ((host = *q) != NULL) { |
| 363 | if (atomic_read(&host->h_count) || host->h_inuse |
| 364 | || time_before(jiffies, host->h_expires)) { |
| 365 | dprintk("nlm_gc_hosts skipping %s (cnt %d use %d exp %ld)\n", |
| 366 | host->h_name, atomic_read(&host->h_count), |
| 367 | host->h_inuse, host->h_expires); |
| 368 | q = &host->h_next; |
| 369 | continue; |
| 370 | } |
| 371 | dprintk("lockd: delete host %s\n", host->h_name); |
| 372 | *q = host->h_next; |
Olaf Kirch | 977faf3 | 2006-10-04 02:15:51 -0700 | [diff] [blame] | 373 | |
| 374 | /* |
| 375 | * Unmonitor unless host was invalidated (i.e. lockd restarted) |
| 376 | */ |
| 377 | nsm_unmonitor(host); |
| 378 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | if ((clnt = host->h_rpcclnt) != NULL) { |
| 380 | if (atomic_read(&clnt->cl_users)) { |
| 381 | printk(KERN_WARNING |
| 382 | "lockd: active RPC handle\n"); |
| 383 | clnt->cl_dead = 1; |
| 384 | } else { |
| 385 | rpc_destroy_client(host->h_rpcclnt); |
| 386 | } |
| 387 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | kfree(host); |
| 389 | nrhosts--; |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | next_gc = jiffies + NLM_HOST_COLLECT; |
| 394 | } |
| 395 | |