diff options
| author | Stanislav Kinsbursky <skinsbursky@parallels.com> | 2012-07-25 08:56:11 -0400 |
|---|---|---|
| committer | J. Bruce Fields <bfields@redhat.com> | 2012-07-27 16:48:43 -0400 |
| commit | 3cf7fb07e077e599d8343113cf4ef81adb2ca627 (patch) | |
| tree | 485476d8e811ca4d75812bde1804f31669e2e977 | |
| parent | 27adaddc8de7f523a172246d5104cf1cd5e2191b (diff) | |
LockD: manage garbage collection timeout per networks namespace
This patch moves next_gc to per-net data.
Note: passed network can be NULL (when Lockd kthread is exiting of Lockd
module is removing).
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
| -rw-r--r-- | fs/lockd/host.c | 12 | ||||
| -rw-r--r-- | fs/lockd/netns.h | 1 |
2 files changed, 10 insertions, 3 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 991274a55664..3636734fe2ba 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
| @@ -21,6 +21,8 @@ | |||
| 21 | 21 | ||
| 22 | #include <net/ipv6.h> | 22 | #include <net/ipv6.h> |
| 23 | 23 | ||
| 24 | #include "netns.h" | ||
| 25 | |||
| 24 | #define NLMDBG_FACILITY NLMDBG_HOSTCACHE | 26 | #define NLMDBG_FACILITY NLMDBG_HOSTCACHE |
| 25 | #define NLM_HOST_NRHASH 32 | 27 | #define NLM_HOST_NRHASH 32 |
| 26 | #define NLM_HOST_REBIND (60 * HZ) | 28 | #define NLM_HOST_REBIND (60 * HZ) |
| @@ -41,7 +43,6 @@ static struct hlist_head nlm_client_hosts[NLM_HOST_NRHASH]; | |||
| 41 | hlist_for_each_entry_safe((host), (pos), (next), \ | 43 | hlist_for_each_entry_safe((host), (pos), (next), \ |
| 42 | (chain), h_hash) | 44 | (chain), h_hash) |
| 43 | 45 | ||
| 44 | static unsigned long next_gc; | ||
| 45 | static unsigned long nrhosts; | 46 | static unsigned long nrhosts; |
| 46 | static DEFINE_MUTEX(nlm_host_mutex); | 47 | static DEFINE_MUTEX(nlm_host_mutex); |
| 47 | 48 | ||
| @@ -337,6 +338,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | |||
| 337 | .hostname_len = hostname_len, | 338 | .hostname_len = hostname_len, |
| 338 | .net = net, | 339 | .net = net, |
| 339 | }; | 340 | }; |
| 341 | struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
| 340 | 342 | ||
| 341 | dprintk("lockd: %s(host='%*s', vers=%u, proto=%s)\n", __func__, | 343 | dprintk("lockd: %s(host='%*s', vers=%u, proto=%s)\n", __func__, |
| 342 | (int)hostname_len, hostname, rqstp->rq_vers, | 344 | (int)hostname_len, hostname, rqstp->rq_vers, |
| @@ -344,7 +346,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, | |||
| 344 | 346 | ||
| 345 | mutex_lock(&nlm_host_mutex); | 347 | mutex_lock(&nlm_host_mutex); |
| 346 | 348 | ||
| 347 | if (time_after_eq(jiffies, next_gc)) | 349 | if (time_after_eq(jiffies, ln->next_gc)) |
| 348 | nlm_gc_hosts(net); | 350 | nlm_gc_hosts(net); |
| 349 | 351 | ||
| 350 | chain = &nlm_server_hosts[nlm_hash_address(ni.sap)]; | 352 | chain = &nlm_server_hosts[nlm_hash_address(ni.sap)]; |
| @@ -653,5 +655,9 @@ nlm_gc_hosts(struct net *net) | |||
| 653 | nlm_destroy_host_locked(host); | 655 | nlm_destroy_host_locked(host); |
| 654 | } | 656 | } |
| 655 | 657 | ||
| 656 | next_gc = jiffies + NLM_HOST_COLLECT; | 658 | if (net) { |
| 659 | struct lockd_net *ln = net_generic(net, lockd_net_id); | ||
| 660 | |||
| 661 | ln->next_gc = jiffies + NLM_HOST_COLLECT; | ||
| 662 | } | ||
| 657 | } | 663 | } |
diff --git a/fs/lockd/netns.h b/fs/lockd/netns.h index ce227e0fbc5c..97c6c771133f 100644 --- a/fs/lockd/netns.h +++ b/fs/lockd/netns.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | struct lockd_net { | 6 | struct lockd_net { |
| 7 | unsigned int nlmsvc_users; | 7 | unsigned int nlmsvc_users; |
| 8 | unsigned long next_gc; | ||
| 8 | }; | 9 | }; |
| 9 | 10 | ||
| 10 | extern int lockd_net_id; | 11 | extern int lockd_net_id; |
