diff options
-rw-r--r-- | fs/lockd/host.c | 14 | ||||
-rw-r--r-- | include/linux/lockd/lockd.h | 3 |
2 files changed, 9 insertions, 8 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 826a89184f90..11b6832277f6 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
@@ -151,7 +151,7 @@ static struct nlm_host *nlm_alloc_host(struct nlm_lookup_host_info *ni, | |||
151 | host->h_state = 0; | 151 | host->h_state = 0; |
152 | host->h_nsmstate = 0; | 152 | host->h_nsmstate = 0; |
153 | host->h_pidcount = 0; | 153 | host->h_pidcount = 0; |
154 | atomic_set(&host->h_count, 1); | 154 | refcount_set(&host->h_count, 1); |
155 | mutex_init(&host->h_mutex); | 155 | mutex_init(&host->h_mutex); |
156 | host->h_nextrebind = now + NLM_HOST_REBIND; | 156 | host->h_nextrebind = now + NLM_HOST_REBIND; |
157 | host->h_expires = now + NLM_HOST_EXPIRE; | 157 | host->h_expires = now + NLM_HOST_EXPIRE; |
@@ -290,7 +290,7 @@ void nlmclnt_release_host(struct nlm_host *host) | |||
290 | 290 | ||
291 | WARN_ON_ONCE(host->h_server); | 291 | WARN_ON_ONCE(host->h_server); |
292 | 292 | ||
293 | if (atomic_dec_and_test(&host->h_count)) { | 293 | if (refcount_dec_and_test(&host->h_count)) { |
294 | WARN_ON_ONCE(!list_empty(&host->h_lockowners)); | 294 | WARN_ON_ONCE(!list_empty(&host->h_lockowners)); |
295 | WARN_ON_ONCE(!list_empty(&host->h_granted)); | 295 | WARN_ON_ONCE(!list_empty(&host->h_granted)); |
296 | WARN_ON_ONCE(!list_empty(&host->h_reclaim)); | 296 | WARN_ON_ONCE(!list_empty(&host->h_reclaim)); |
@@ -410,7 +410,7 @@ void nlmsvc_release_host(struct nlm_host *host) | |||
410 | dprintk("lockd: release server host %s\n", host->h_name); | 410 | dprintk("lockd: release server host %s\n", host->h_name); |
411 | 411 | ||
412 | WARN_ON_ONCE(!host->h_server); | 412 | WARN_ON_ONCE(!host->h_server); |
413 | atomic_dec(&host->h_count); | 413 | refcount_dec(&host->h_count); |
414 | } | 414 | } |
415 | 415 | ||
416 | /* | 416 | /* |
@@ -504,7 +504,7 @@ struct nlm_host * nlm_get_host(struct nlm_host *host) | |||
504 | { | 504 | { |
505 | if (host) { | 505 | if (host) { |
506 | dprintk("lockd: get host %s\n", host->h_name); | 506 | dprintk("lockd: get host %s\n", host->h_name); |
507 | atomic_inc(&host->h_count); | 507 | refcount_inc(&host->h_count); |
508 | host->h_expires = jiffies + NLM_HOST_EXPIRE; | 508 | host->h_expires = jiffies + NLM_HOST_EXPIRE; |
509 | } | 509 | } |
510 | return host; | 510 | return host; |
@@ -593,7 +593,7 @@ static void nlm_complain_hosts(struct net *net) | |||
593 | if (net && host->net != net) | 593 | if (net && host->net != net) |
594 | continue; | 594 | continue; |
595 | dprintk(" %s (cnt %d use %d exp %ld net %x)\n", | 595 | dprintk(" %s (cnt %d use %d exp %ld net %x)\n", |
596 | host->h_name, atomic_read(&host->h_count), | 596 | host->h_name, refcount_read(&host->h_count), |
597 | host->h_inuse, host->h_expires, host->net->ns.inum); | 597 | host->h_inuse, host->h_expires, host->net->ns.inum); |
598 | } | 598 | } |
599 | } | 599 | } |
@@ -662,11 +662,11 @@ nlm_gc_hosts(struct net *net) | |||
662 | for_each_host_safe(host, next, chain, nlm_server_hosts) { | 662 | for_each_host_safe(host, next, chain, nlm_server_hosts) { |
663 | if (net && host->net != net) | 663 | if (net && host->net != net) |
664 | continue; | 664 | continue; |
665 | if (atomic_read(&host->h_count) || host->h_inuse | 665 | if (refcount_read(&host->h_count) || host->h_inuse |
666 | || time_before(jiffies, host->h_expires)) { | 666 | || time_before(jiffies, host->h_expires)) { |
667 | dprintk("nlm_gc_hosts skipping %s " | 667 | dprintk("nlm_gc_hosts skipping %s " |
668 | "(cnt %d use %d exp %ld net %x)\n", | 668 | "(cnt %d use %d exp %ld net %x)\n", |
669 | host->h_name, atomic_read(&host->h_count), | 669 | host->h_name, refcount_read(&host->h_count), |
670 | host->h_inuse, host->h_expires, | 670 | host->h_inuse, host->h_expires, |
671 | host->net->ns.inum); | 671 | host->net->ns.inum); |
672 | continue; | 672 | continue; |
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h index d7d313fb9cd4..39dfeea20963 100644 --- a/include/linux/lockd/lockd.h +++ b/include/linux/lockd/lockd.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <net/ipv6.h> | 17 | #include <net/ipv6.h> |
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/kref.h> | 19 | #include <linux/kref.h> |
20 | #include <linux/refcount.h> | ||
20 | #include <linux/utsname.h> | 21 | #include <linux/utsname.h> |
21 | #include <linux/lockd/bind.h> | 22 | #include <linux/lockd/bind.h> |
22 | #include <linux/lockd/xdr.h> | 23 | #include <linux/lockd/xdr.h> |
@@ -58,7 +59,7 @@ struct nlm_host { | |||
58 | u32 h_state; /* pseudo-state counter */ | 59 | u32 h_state; /* pseudo-state counter */ |
59 | u32 h_nsmstate; /* true remote NSM state */ | 60 | u32 h_nsmstate; /* true remote NSM state */ |
60 | u32 h_pidcount; /* Pseudopids */ | 61 | u32 h_pidcount; /* Pseudopids */ |
61 | atomic_t h_count; /* reference count */ | 62 | refcount_t h_count; /* reference count */ |
62 | struct mutex h_mutex; /* mutex for pmap binding */ | 63 | struct mutex h_mutex; /* mutex for pmap binding */ |
63 | unsigned long h_nextrebind; /* next portmap call */ | 64 | unsigned long h_nextrebind; /* next portmap call */ |
64 | unsigned long h_expires; /* eligible for GC */ | 65 | unsigned long h_expires; /* eligible for GC */ |