diff options
Diffstat (limited to 'fs/lockd')
-rw-r--r-- | fs/lockd/host.c | 29 | ||||
-rw-r--r-- | fs/lockd/svcsubs.c | 7 |
2 files changed, 15 insertions, 21 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 0e17090c310f..abdd75d44dd4 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -32,15 +32,15 @@ | |||
32 | static struct hlist_head nlm_server_hosts[NLM_HOST_NRHASH]; | 32 | static struct hlist_head nlm_server_hosts[NLM_HOST_NRHASH]; |
33 | static struct hlist_head nlm_client_hosts[NLM_HOST_NRHASH]; | 33 | static struct hlist_head nlm_client_hosts[NLM_HOST_NRHASH]; |
34 | 34 | ||
35 | #define for_each_host(host, pos, chain, table) \ | 35 | #define for_each_host(host, chain, table) \ |
36 | for ((chain) = (table); \ | 36 | for ((chain) = (table); \ |
37 | (chain) < (table) + NLM_HOST_NRHASH; ++(chain)) \ | 37 | (chain) < (table) + NLM_HOST_NRHASH; ++(chain)) \ |
38 | hlist_for_each_entry((host), (pos), (chain), h_hash) | 38 | hlist_for_each_entry((host), (chain), h_hash) |
39 | 39 | ||
40 | #define for_each_host_safe(host, pos, next, chain, table) \ | 40 | #define for_each_host_safe(host, next, chain, table) \ |
41 | for ((chain) = (table); \ | 41 | for ((chain) = (table); \ |
42 | (chain) < (table) + NLM_HOST_NRHASH; ++(chain)) \ | 42 | (chain) < (table) + NLM_HOST_NRHASH; ++(chain)) \ |
43 | hlist_for_each_entry_safe((host), (pos), (next), \ | 43 | hlist_for_each_entry_safe((host), (next), \ |
44 | (chain), h_hash) | 44 | (chain), h_hash) |
45 | 45 | ||
46 | static unsigned long nrhosts; | 46 | static unsigned long nrhosts; |
@@ -225,7 +225,6 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, | |||
225 | .net = net, | 225 | .net = net, |
226 | }; | 226 | }; |
227 | struct hlist_head *chain; | 227 | struct hlist_head *chain; |
228 | struct hlist_node *pos; | ||
229 | struct nlm_host *host; | 228 | struct nlm_host *host; |
230 | struct nsm_handle *nsm = NULL; | 229 | struct nsm_handle *nsm = NULL; |
231 | struct lockd_net *ln = net_generic(net, lockd_net_id); | 230 | struct lockd_net *ln = net_generic(net, lockd_net_id); |
@@ -237,7 +236,7 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr *sap, | |||
237 | mutex_lock(&nlm_host_mutex); | 236 | mutex_lock(&nlm_host_mutex); |
238 | 237 | ||
239 | chain = &nlm_client_hosts[nlm_hash_address(sap)]; | 238 | chain = &nlm_client_hosts[nlm_hash_address(sap)]; |
240 | hlist_for_each_entry(host, pos, chain, h_hash) { | 239 | hlist_for_each_entry(host, chain, h_hash) { |
241 | if (host->net != net) | 240 | if (host->net != net) |
242 | continue; | 241 | continue; |
243 | if (!rpc_cmp_addr(nlm_addr(host), sap)) | 242 | if (!rpc_cmp_addr(nlm_addr(host), sap)) |
@@ -322,7 +321,6 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | |||
322 | const size_t hostname_len) | 321 | const size_t hostname_len) |
323 | { | 322 | { |
324 | struct hlist_head *chain; | 323 | struct hlist_head *chain; |
325 | struct hlist_node *pos; | ||
326 | struct nlm_host *host = NULL; | 324 | struct nlm_host *host = NULL; |
327 | struct nsm_handle *nsm = NULL; | 325 | struct nsm_handle *nsm = NULL; |
328 | struct sockaddr *src_sap = svc_daddr(rqstp); | 326 | struct sockaddr *src_sap = svc_daddr(rqstp); |
@@ -350,7 +348,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | |||
350 | nlm_gc_hosts(net); | 348 | nlm_gc_hosts(net); |
351 | 349 | ||
352 | chain = &nlm_server_hosts[nlm_hash_address(ni.sap)]; | 350 | chain = &nlm_server_hosts[nlm_hash_address(ni.sap)]; |
353 | hlist_for_each_entry(host, pos, chain, h_hash) { | 351 | hlist_for_each_entry(host, chain, h_hash) { |
354 | if (host->net != net) | 352 | if (host->net != net) |
355 | continue; | 353 | continue; |
356 | if (!rpc_cmp_addr(nlm_addr(host), ni.sap)) | 354 | if (!rpc_cmp_addr(nlm_addr(host), ni.sap)) |
@@ -515,10 +513,9 @@ static struct nlm_host *next_host_state(struct hlist_head *cache, | |||
515 | { | 513 | { |
516 | struct nlm_host *host; | 514 | struct nlm_host *host; |
517 | struct hlist_head *chain; | 515 | struct hlist_head *chain; |
518 | struct hlist_node *pos; | ||
519 | 516 | ||
520 | mutex_lock(&nlm_host_mutex); | 517 | mutex_lock(&nlm_host_mutex); |
521 | for_each_host(host, pos, chain, cache) { | 518 | for_each_host(host, chain, cache) { |
522 | if (host->h_nsmhandle == nsm | 519 | if (host->h_nsmhandle == nsm |
523 | && host->h_nsmstate != info->state) { | 520 | && host->h_nsmstate != info->state) { |
524 | host->h_nsmstate = info->state; | 521 | host->h_nsmstate = info->state; |
@@ -570,7 +567,6 @@ void nlm_host_rebooted(const struct nlm_reboot *info) | |||
570 | static void nlm_complain_hosts(struct net *net) | 567 | static void nlm_complain_hosts(struct net *net) |
571 | { | 568 | { |
572 | struct hlist_head *chain; | 569 | struct hlist_head *chain; |
573 | struct hlist_node *pos; | ||
574 | struct nlm_host *host; | 570 | struct nlm_host *host; |
575 | 571 | ||
576 | if (net) { | 572 | if (net) { |
@@ -587,7 +583,7 @@ static void nlm_complain_hosts(struct net *net) | |||
587 | dprintk("lockd: %lu hosts left:\n", nrhosts); | 583 | dprintk("lockd: %lu hosts left:\n", nrhosts); |
588 | } | 584 | } |
589 | 585 | ||
590 | for_each_host(host, pos, chain, nlm_server_hosts) { | 586 | for_each_host(host, chain, nlm_server_hosts) { |
591 | if (net && host->net != net) | 587 | if (net && host->net != net) |
592 | continue; | 588 | continue; |
593 | dprintk(" %s (cnt %d use %d exp %ld net %p)\n", | 589 | dprintk(" %s (cnt %d use %d exp %ld net %p)\n", |
@@ -600,14 +596,13 @@ void | |||
600 | nlm_shutdown_hosts_net(struct net *net) | 596 | nlm_shutdown_hosts_net(struct net *net) |
601 | { | 597 | { |
602 | struct hlist_head *chain; | 598 | struct hlist_head *chain; |
603 | struct hlist_node *pos; | ||
604 | struct nlm_host *host; | 599 | struct nlm_host *host; |
605 | 600 | ||
606 | mutex_lock(&nlm_host_mutex); | 601 | mutex_lock(&nlm_host_mutex); |
607 | 602 | ||
608 | /* First, make all hosts eligible for gc */ | 603 | /* First, make all hosts eligible for gc */ |
609 | dprintk("lockd: nuking all hosts in net %p...\n", net); | 604 | dprintk("lockd: nuking all hosts in net %p...\n", net); |
610 | for_each_host(host, pos, chain, nlm_server_hosts) { | 605 | for_each_host(host, chain, nlm_server_hosts) { |
611 | if (net && host->net != net) | 606 | if (net && host->net != net) |
612 | continue; | 607 | continue; |
613 | host->h_expires = jiffies - 1; | 608 | host->h_expires = jiffies - 1; |
@@ -644,11 +639,11 @@ static void | |||
644 | nlm_gc_hosts(struct net *net) | 639 | nlm_gc_hosts(struct net *net) |
645 | { | 640 | { |
646 | struct hlist_head *chain; | 641 | struct hlist_head *chain; |
647 | struct hlist_node *pos, *next; | 642 | struct hlist_node *next; |
648 | struct nlm_host *host; | 643 | struct nlm_host *host; |
649 | 644 | ||
650 | dprintk("lockd: host garbage collection for net %p\n", net); | 645 | dprintk("lockd: host garbage collection for net %p\n", net); |
651 | for_each_host(host, pos, chain, nlm_server_hosts) { | 646 | for_each_host(host, chain, nlm_server_hosts) { |
652 | if (net && host->net != net) | 647 | if (net && host->net != net) |
653 | continue; | 648 | continue; |
654 | host->h_inuse = 0; | 649 | host->h_inuse = 0; |
@@ -657,7 +652,7 @@ nlm_gc_hosts(struct net *net) | |||
657 | /* Mark all hosts that hold locks, blocks or shares */ | 652 | /* Mark all hosts that hold locks, blocks or shares */ |
658 | nlmsvc_mark_resources(net); | 653 | nlmsvc_mark_resources(net); |
659 | 654 | ||
660 | for_each_host_safe(host, pos, next, chain, nlm_server_hosts) { | 655 | for_each_host_safe(host, next, chain, nlm_server_hosts) { |
661 | if (net && host->net != net) | 656 | if (net && host->net != net) |
662 | continue; | 657 | continue; |
663 | if (atomic_read(&host->h_count) || host->h_inuse | 658 | if (atomic_read(&host->h_count) || host->h_inuse |
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index b3a24b07d981..d17bb62b06d6 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c | |||
@@ -84,7 +84,6 @@ __be32 | |||
84 | nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, | 84 | nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, |
85 | struct nfs_fh *f) | 85 | struct nfs_fh *f) |
86 | { | 86 | { |
87 | struct hlist_node *pos; | ||
88 | struct nlm_file *file; | 87 | struct nlm_file *file; |
89 | unsigned int hash; | 88 | unsigned int hash; |
90 | __be32 nfserr; | 89 | __be32 nfserr; |
@@ -96,7 +95,7 @@ nlm_lookup_file(struct svc_rqst *rqstp, struct nlm_file **result, | |||
96 | /* Lock file table */ | 95 | /* Lock file table */ |
97 | mutex_lock(&nlm_file_mutex); | 96 | mutex_lock(&nlm_file_mutex); |
98 | 97 | ||
99 | hlist_for_each_entry(file, pos, &nlm_files[hash], f_list) | 98 | hlist_for_each_entry(file, &nlm_files[hash], f_list) |
100 | if (!nfs_compare_fh(&file->f_handle, f)) | 99 | if (!nfs_compare_fh(&file->f_handle, f)) |
101 | goto found; | 100 | goto found; |
102 | 101 | ||
@@ -248,13 +247,13 @@ static int | |||
248 | nlm_traverse_files(void *data, nlm_host_match_fn_t match, | 247 | nlm_traverse_files(void *data, nlm_host_match_fn_t match, |
249 | int (*is_failover_file)(void *data, struct nlm_file *file)) | 248 | int (*is_failover_file)(void *data, struct nlm_file *file)) |
250 | { | 249 | { |
251 | struct hlist_node *pos, *next; | 250 | struct hlist_node *next; |
252 | struct nlm_file *file; | 251 | struct nlm_file *file; |
253 | int i, ret = 0; | 252 | int i, ret = 0; |
254 | 253 | ||
255 | mutex_lock(&nlm_file_mutex); | 254 | mutex_lock(&nlm_file_mutex); |
256 | for (i = 0; i < FILE_NRHASH; i++) { | 255 | for (i = 0; i < FILE_NRHASH; i++) { |
257 | hlist_for_each_entry_safe(file, pos, next, &nlm_files[i], f_list) { | 256 | hlist_for_each_entry_safe(file, next, &nlm_files[i], f_list) { |
258 | if (is_failover_file && !is_failover_file(data, file)) | 257 | if (is_failover_file && !is_failover_file(data, file)) |
259 | continue; | 258 | continue; |
260 | file->f_count++; | 259 | file->f_count++; |