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.

ns: add __ns_ref_read()

Implement ns_ref_read() the same way as ns_ref_{get,put}().
No point in making that any more special or different from the other
helpers.

Link: https://patch.msgid.link/20251029-work-namespace-nstree-listns-v4-9-2e6f823ebdc0@kernel.org
Tested-by: syzbot@syzkaller.appspotmail.com
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>

+6 -1
+6 -1
include/linux/ns_common.h
··· 154 154 return refcount_inc_not_zero(&ns->__ns_ref); 155 155 } 156 156 157 - #define ns_ref_read(__ns) refcount_read(&to_ns_common((__ns))->__ns_ref) 157 + static __always_inline __must_check int __ns_ref_read(const struct ns_common *ns) 158 + { 159 + return refcount_read(&ns->__ns_ref); 160 + } 161 + 162 + #define ns_ref_read(__ns) __ns_ref_read(to_ns_common((__ns))) 158 163 #define ns_ref_inc(__ns) refcount_inc(&to_ns_common((__ns))->__ns_ref) 159 164 #define ns_ref_get(__ns) __ns_ref_get(to_ns_common((__ns))) 160 165 #define ns_ref_put(__ns) __ns_ref_put(to_ns_common((__ns)))