Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1942593pxa; Mon, 3 Aug 2020 03:20:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIRN176byorKaWsop6WNt6gX3f3SjC3C0i1tZXwJwja0y+5crX4caF7prKT+DJs/j78JKI X-Received: by 2002:a17:906:7155:: with SMTP id z21mr16886212ejj.282.1596450011437; Mon, 03 Aug 2020 03:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596450011; cv=none; d=google.com; s=arc-20160816; b=dJFZQJe2+gf6DTdlk0fi38QWyYU0344wGm/3GvrJwdw2V84upCjzS/fJuA6hitKXDs KQKDxb5wzt/SDx7bHykX0TWdYO0JDeqpcW2DwFs2ZmuK9GUEVFmR+AWEiUl30QRb4LUk wETHSr3NwaxHpDieEAUt8ItKuc+bYCBNHKsaC1gXM6fEeQVNe7IGyGi3M6frm8Pl+n2Y 59Z+h/18iajsYuO39QP33TkNuAjmDDp6Um2xE+OYpQFqapxdAFac7wwKV+O8VB9xmsB+ e5UpoBBh7LvQf0Q9sDvWg/v1svuviIhqxFLe5dAExi3zXc85GwLcjLtWQ8NNKAdp5FMe TnoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject; bh=8K8SpLW1hd/eCsaKQ8FVpnyvf6nBiN2F3m5BYfvNXh8=; b=VKoCyDC53ntIJegpKousfr5yrdNq6yRKR3IGBUelMuLKfx9+sWrLckG+chys7ISUwd 9E3OfrM9dyPWy3TNtGkWbm2bb1s+qprrqzdM+WIJ2mRZ2kOTSLYdfbtRKLZl7/HaTaig U5q8Gfh6+n3zWo3DXM4DzwBM0ISIa3GYzmloDSvYjdWTFZlATiXcfQMpmM3MgyfFydKP TccBEmSztoSQ4jaasZIXvIXefrK3cZI5X+8udBIb/CSfxnj3KJvWLLmT3qzXBzVbcBv8 4ZP4NZKLtz7rchdIRQVt5w9U4p5u6b/1bvtfdsuvmGnXpMl/DmK8y3x56rcMls7YKmBR Griw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i13si1281053ejv.279.2020.08.03.03.19.49; Mon, 03 Aug 2020 03:20:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726693AbgHCKQr (ORCPT + 99 others); Mon, 3 Aug 2020 06:16:47 -0400 Received: from relay.sw.ru ([185.231.240.75]:37898 "EHLO relay3.sw.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725951AbgHCKQq (ORCPT ); Mon, 3 Aug 2020 06:16:46 -0400 Received: from [192.168.15.50] (helo=localhost.localdomain) by relay3.sw.ru with esmtp (Exim 4.93) (envelope-from ) id 1k2XW3-0002OI-Ox; Mon, 03 Aug 2020 13:16:23 +0300 Subject: [PATCH 6/8] mnt: Use generic ns_common::count From: Kirill Tkhai To: christian.brauner@ubuntu.com, akpm@linux-foundation.org, ebiederm@xmission.com, viro@zeniv.linux.org.uk, adobriyan@gmail.com, davem@davemloft.net, linux-kernel@vger.kernel.org, ktkhai@virtuozzo.com Date: Mon, 03 Aug 2020 13:16:42 +0300 Message-ID: <159644980287.604812.761686947449081169.stgit@localhost.localdomain> In-Reply-To: <159644958332.604812.13004003379291842292.stgit@localhost.localdomain> References: <159644958332.604812.13004003379291842292.stgit@localhost.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert mount namespace to use generic counter. Signed-off-by: Kirill Tkhai Acked-by: Christian Brauner --- fs/mount.h | 3 +-- fs/namespace.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/mount.h b/fs/mount.h index c3e0bb6e5782..f296862032ec 100644 --- a/fs/mount.h +++ b/fs/mount.h @@ -7,7 +7,6 @@ #include struct mnt_namespace { - atomic_t count; struct ns_common ns; struct mount * root; /* @@ -130,7 +129,7 @@ static inline void detach_mounts(struct dentry *dentry) static inline void get_mnt_ns(struct mnt_namespace *ns) { - atomic_inc(&ns->count); + refcount_inc(&ns->ns.count); } extern seqlock_t mount_lock; diff --git a/fs/namespace.c b/fs/namespace.c index 31c387794fbd..8c39810e6ec3 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3296,7 +3296,7 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool a new_ns->ns.ops = &mntns_operations; if (!anon) new_ns->seq = atomic64_add_return(1, &mnt_ns_seq); - atomic_set(&new_ns->count, 1); + refcount_set(&new_ns->ns.count, 1); INIT_LIST_HEAD(&new_ns->list); init_waitqueue_head(&new_ns->poll); spin_lock_init(&new_ns->ns_lock); @@ -3870,7 +3870,7 @@ void __init mnt_init(void) void put_mnt_ns(struct mnt_namespace *ns) { - if (!atomic_dec_and_test(&ns->count)) + if (!refcount_dec_and_test(&ns->ns.count)) return; drop_collected_mounts(&ns->root->mnt); free_mnt_ns(ns);