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 asserts for initial namespace active reference counts

They always remain fixed at one. Notice when that assumptions is broken.

Link: https://patch.msgid.link/20251110-work-namespace-nstree-fixes-v1-14-e8a9264e0fb9@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>

+4
+4
include/linux/ns_common.h
··· 69 69 { 70 70 if (is_ns_init_id(ns)) { 71 71 VFS_WARN_ON_ONCE(__ns_ref_read(ns) != 1); 72 + VFS_WARN_ON_ONCE(__ns_ref_active_read(ns) != 1); 72 73 return false; 73 74 } 74 75 if (refcount_dec_and_test(&ns->__ns_ref)) { ··· 83 82 { 84 83 if (is_ns_init_id(ns)) { 85 84 VFS_WARN_ON_ONCE(__ns_ref_read(ns) != 1); 85 + VFS_WARN_ON_ONCE(__ns_ref_active_read(ns) != 1); 86 86 return true; 87 87 } 88 88 if (refcount_inc_not_zero(&ns->__ns_ref)) ··· 96 94 { 97 95 if (is_ns_init_id(ns)) { 98 96 VFS_WARN_ON_ONCE(__ns_ref_read(ns) != 1); 97 + VFS_WARN_ON_ONCE(__ns_ref_active_read(ns) != 1); 99 98 return; 100 99 } 101 100 refcount_inc(&ns->__ns_ref); ··· 107 104 { 108 105 if (is_ns_init_id(ns)) { 109 106 VFS_WARN_ON_ONCE(__ns_ref_read(ns) != 1); 107 + VFS_WARN_ON_ONCE(__ns_ref_active_read(ns) != 1); 110 108 return false; 111 109 } 112 110 return refcount_dec_and_lock(&ns->__ns_ref, ns_lock);