From: Christian Brauner Date: Thu, 18 Sep 2025 10:11:49 +0000 (+0200) Subject: ipc: port to ns_ref_*() helpers X-Git-Tag: v6.18-rc1~232^2~4^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d4825c99d6a738c565d5142ce37369368a4352da;p=thirdparty%2Fkernel%2Fstable.git ipc: port to ns_ref_*() helpers Stop accessing ns.count directly. Reviewed-by: Jan Kara Signed-off-by: Christian Brauner --- diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h index 924e4754374fb..21eff63f47dae 100644 --- a/include/linux/ipc_namespace.h +++ b/include/linux/ipc_namespace.h @@ -140,14 +140,14 @@ extern struct ipc_namespace *copy_ipcs(unsigned long flags, static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns) { if (ns) - refcount_inc(&ns->ns.count); + ns_ref_inc(ns); return ns; } static inline struct ipc_namespace *get_ipc_ns_not_zero(struct ipc_namespace *ns) { if (ns) { - if (refcount_inc_not_zero(&ns->ns.count)) + if (ns_ref_get(ns)) return ns; } diff --git a/ipc/namespace.c b/ipc/namespace.c index 09d261a1a2aa4..bd85d1c9d2c21 100644 --- a/ipc/namespace.c +++ b/ipc/namespace.c @@ -199,7 +199,7 @@ static void free_ipc(struct work_struct *unused) */ void put_ipc_ns(struct ipc_namespace *ns) { - if (refcount_dec_and_lock(&ns->ns.count, &mq_lock)) { + if (ns_ref_put_and_lock(ns, &mq_lock)) { mq_clear_sbinfo(ns); spin_unlock(&mq_lock);