From nobody Mon Feb 9 11:47:09 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B95282C0282; Wed, 22 Oct 2025 16:06:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761149213; cv=none; b=L09T5bwoEkr4vLJK+PoHqnYwIVsbdP41sQlYX2MkBPsAerWbEkNG2SzMVg4cXBoYotAoDsGqJhkGQuyPMLTOR45BxCu+KgT1reff+S/5k4bTupxyy7+PbDWrhnIv6+KAZ4hZMh5b2eHsp+dyc83YRAT+OOPJW8jEjKz0EMmvQog= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761149213; c=relaxed/simple; bh=QM8oyzyJ0QczVJ0uxGx22MIzfw44XMMyED0mCYHZDF8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N76EtwJgMUXm0ob/JV2vp718F7+fhCJp8ObooQHKNL8KEKfkPq5UeVP3Ozv4flfKVhGSHetyl7nz6+QDhGEzD+UWl7we6/fEqDfQJInuFXJXjKclIjoRgYHqVwXDWOoL5w3xWh/lF2Pj/l/KU7KjShkuEebeNn9l0BSIxpcvTvc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gEpB/PVF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gEpB/PVF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B61AC4CEE7; Wed, 22 Oct 2025 16:06:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761149213; bh=QM8oyzyJ0QczVJ0uxGx22MIzfw44XMMyED0mCYHZDF8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gEpB/PVFOSaOpvp6ZR6yhvx1s5SZLhqFReaEmmbOrhMBrf8TM7A/NHAwomU1AdbHK VzxZtjN4LxE7PlBFQ1hNGvXYbm+DnEcNERJd5Be26Zk9lYGYBXqsmjA56eHZh4gAy7 1OinKw/8JZpf1v750FCJ98PZn5hsIGMHQ/l1cjjQWsK2mcYA9GlwJskWBT/iGwVlMK cxuIRiw67WelzJpOaEfzXhDc41/sJIjbDbSm20IyXWbyDMDrNIflhbwbllu+JcurWH 9mcRmZfKc0+AZoc8znBwgLDKaBj1SMQneuCBFXSPRSNYrrVhNIQiSeoIHzXthL7XBQ tup10iDnrgvYw== From: Christian Brauner Date: Wed, 22 Oct 2025 18:05:47 +0200 Subject: [PATCH v2 09/63] ns: add __ns_ref_read() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251022-work-namespace-nstree-listns-v2-9-71a588572371@kernel.org> References: <20251022-work-namespace-nstree-listns-v2-0-71a588572371@kernel.org> In-Reply-To: <20251022-work-namespace-nstree-listns-v2-0-71a588572371@kernel.org> To: linux-fsdevel@vger.kernel.org, Josef Bacik , Jeff Layton Cc: Jann Horn , Mike Yuan , =?utf-8?q?Zbigniew_J=C4=99drzejewski-Szmek?= , Lennart Poettering , Daan De Meyer , Aleksa Sarai , Amir Goldstein , Tejun Heo , Johannes Weiner , Thomas Gleixner , Alexander Viro , Jan Kara , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, bpf@vger.kernel.org, Eric Dumazet , Jakub Kicinski , netdev@vger.kernel.org, Arnd Bergmann , Christian Brauner X-Mailer: b4 0.15-dev-96507 X-Developer-Signature: v=1; a=openpgp-sha256; l=1108; i=brauner@kernel.org; h=from:subject:message-id; bh=QM8oyzyJ0QczVJ0uxGx22MIzfw44XMMyED0mCYHZDF8=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWT8ZHjC6Pnba1Ph24mX+DdlzE1Ta7ctUHlw48+fKyJOu /jeJPpKdZSyMIhxMciKKbI4tJuEyy3nqdhslKkBM4eVCWQIAxenAEzEpJ3hr8AVC/ei+BpBu+Ni v2/Za4X2rdm/duk3TbmvZzmV645Y72P4KzLz/NW80qBZCqc/nDne7BLcnfrzk+c9Dc8FubyV8Z8 1WAE= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 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. Signed-off-by: Christian Brauner --- include/linux/ns_common.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h index f5b68b8abb54..32114d5698dc 100644 --- a/include/linux/ns_common.h +++ b/include/linux/ns_common.h @@ -143,7 +143,12 @@ static __always_inline __must_check bool __ns_ref_get(= struct ns_common *ns) return refcount_inc_not_zero(&ns->__ns_ref); } =20 -#define ns_ref_read(__ns) refcount_read(&to_ns_common((__ns))->__ns_ref) +static __always_inline __must_check int __ns_ref_read(const struct ns_comm= on *ns) +{ + return refcount_read(&ns->__ns_ref); +} + +#define ns_ref_read(__ns) __ns_ref_read(to_ns_common((__ns))) #define ns_ref_inc(__ns) refcount_inc(&to_ns_common((__ns))->__ns_ref) #define ns_ref_get(__ns) __ns_ref_get(to_ns_common((__ns))) #define ns_ref_put(__ns) __ns_ref_put(to_ns_common((__ns))) --=20 2.47.3