aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r--include/net/net_namespace.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 049008493faf..f306b2aa15a4 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -51,7 +51,7 @@ struct net {
51 refcount_t passive; /* To decided when the network 51 refcount_t passive; /* To decided when the network
52 * namespace should be freed. 52 * namespace should be freed.
53 */ 53 */
54 atomic_t count; /* To decided when the network 54 refcount_t count; /* To decided when the network
55 * namespace should be shut down. 55 * namespace should be shut down.
56 */ 56 */
57 spinlock_t rules_mod_lock; 57 spinlock_t rules_mod_lock;
@@ -195,7 +195,7 @@ void __put_net(struct net *net);
195 195
196static inline struct net *get_net(struct net *net) 196static inline struct net *get_net(struct net *net)
197{ 197{
198 atomic_inc(&net->count); 198 refcount_inc(&net->count);
199 return net; 199 return net;
200} 200}
201 201
@@ -206,14 +206,14 @@ static inline struct net *maybe_get_net(struct net *net)
206 * exists. If the reference count is zero this 206 * exists. If the reference count is zero this
207 * function fails and returns NULL. 207 * function fails and returns NULL.
208 */ 208 */
209 if (!atomic_inc_not_zero(&net->count)) 209 if (!refcount_inc_not_zero(&net->count))
210 net = NULL; 210 net = NULL;
211 return net; 211 return net;
212} 212}
213 213
214static inline void put_net(struct net *net) 214static inline void put_net(struct net *net)
215{ 215{
216 if (atomic_dec_and_test(&net->count)) 216 if (refcount_dec_and_test(&net->count))
217 __put_net(net); 217 __put_net(net);
218} 218}
219 219
@@ -225,7 +225,7 @@ int net_eq(const struct net *net1, const struct net *net2)
225 225
226static inline int check_net(const struct net *net) 226static inline int check_net(const struct net *net)
227{ 227{
228 return atomic_read(&net->count) != 0; 228 return refcount_read(&net->count) != 0;
229} 229}
230 230
231void net_drop_ns(void *); 231void net_drop_ns(void *);