Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: port to ns_ref_*() helpers

Stop accessing ns.count directly.

Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

+4 -4
+4 -4
include/net/net_namespace.h
··· 270 270 /* Try using get_net_track() instead */ 271 271 static inline struct net *get_net(struct net *net) 272 272 { 273 - refcount_inc(&net->ns.count); 273 + ns_ref_inc(net); 274 274 return net; 275 275 } 276 276 ··· 281 281 * exists. If the reference count is zero this 282 282 * function fails and returns NULL. 283 283 */ 284 - if (!refcount_inc_not_zero(&net->ns.count)) 284 + if (!ns_ref_get(net)) 285 285 net = NULL; 286 286 return net; 287 287 } ··· 289 289 /* Try using put_net_track() instead */ 290 290 static inline void put_net(struct net *net) 291 291 { 292 - if (refcount_dec_and_test(&net->ns.count)) 292 + if (ns_ref_put(net)) 293 293 __put_net(net); 294 294 } 295 295 ··· 301 301 302 302 static inline int check_net(const struct net *net) 303 303 { 304 - return refcount_read(&net->ns.count) != 0; 304 + return ns_ref_read(net) != 0; 305 305 } 306 306 307 307 void net_drop_ns(void *);