From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45E81CCD19A for ; Tue, 18 Nov 2025 05:18:14 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4d9XsD3kDPz3dJB; Tue, 18 Nov 2025 16:16:32 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip="2a03:a000:7:0:5054:ff:fe1c:15ff" ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1763442992; cv=none; b=XPW2Wjbgc6NLJ58pPEgpMNNGaUR1APqoXs9IO1mgoji++Q//xv6lSg+bdfuw3WBhrJp3SXa70Mzp16oKMNHABb+BIJW/jqod/lSmevGZN06Va23JsiJ09cio7Qoc11HxMjjba4QEHr9MEyUU7tOoieyD+LoYpdFtDKh6m70iwxYl7uGUMVOa03E32dMtJmgk9pfQiDsaMQZ5Cdpstp4tqiz4p4h1SnZjwDn2ICwqbmDy79xlFg2ylouL7G9uE+V8FwAsgc7S8t8IW8heULx2xXK2pD1qN8mWZYYo1r6W6NI3J/cmleP3f6YFW//usMUesik25B1722Y1Af+67irBRA== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1763442992; c=relaxed/relaxed; bh=/QE5WDCT/6E4/9SENMzbAx4/TtK/VNDZoQCVo0AmPFA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Dbzrs3eB6Vr4q7K3rHESx7Oj5lGUaSOgEiqVHhZNHTFuY/kQSfircOA6Qf7UG1MBL6fksupBg4Q9x3lyTscA7aLvgJVt3JbL6ShdVBfQu4+bD2MM+eWxLbkezBP4LRIsB6JOiRxBIlHTUP9fbtZyeEeJtmnqSTn+JEW4VajeWdhrDac5uUGriCVaQa8V5rPDG8P5R8xmCyKIFBbuE8ZdB7bGRScxDmfx1N6BEQXdsnG4sRWGrbekUdmaZquhBlilFTVn8jFMdjEUhFmPtv9n2nwytpuilhhzUMomkyQyldbSo3s+Fyy6aj/kTc1aBYqLvnlf7i8TMEw/twn6MJAt9A== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; dkim=pass (2048-bit key; unprotected) header.d=linux.org.uk header.i=@linux.org.uk header.a=rsa-sha256 header.s=zeniv-20220401 header.b=nbw2hpBO; dkim-atps=neutral; spf=none (client-ip=2a03:a000:7:0:5054:ff:fe1c:15ff; helo=zeniv.linux.org.uk; envelope-from=viro@ftp.linux.org.uk; receiver=lists.ozlabs.org) smtp.mailfrom=ftp.linux.org.uk Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linux.org.uk header.i=@linux.org.uk header.a=rsa-sha256 header.s=zeniv-20220401 header.b=nbw2hpBO; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=ftp.linux.org.uk (client-ip=2a03:a000:7:0:5054:ff:fe1c:15ff; helo=zeniv.linux.org.uk; envelope-from=viro@ftp.linux.org.uk; receiver=lists.ozlabs.org) Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4d9Xrz2Y2qz30Vs for ; Tue, 18 Nov 2025 16:16:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=/QE5WDCT/6E4/9SENMzbAx4/TtK/VNDZoQCVo0AmPFA=; b=nbw2hpBO5FUjslRgDpDLHuqSys mMp4OF+mLp80JjLP4RwNZxq3tU3uTXK6B7LZOCt12xwnyqibPJY69Qk8Fi9+pab8XCpSvSaN3GBST +Njl70OepWLfTkhLZMDAPXxD9ZK5UDhJsIvan2d21SnGbI+fJItPz6jcIfY1xAllTGpgEo83t3zGL qTrHMAp1QgyGZdN7VOcfRHEVPZFiwJ5pYnGouUH9gUQo0P78a9sAOmDAHFHMW/chnqo4+WtCcdi1/ u60C5n85obiT/jGBVsA+k2QUfMjjIbr31iJXh5l/ldtJAEvErtLsCRtJAZs4HirNXI/+hx/Vl3Ug3 WQmPo/tw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1vLE4a-0000000GEgh-38hT; Tue, 18 Nov 2025 05:16:12 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: torvalds@linux-foundation.org, brauner@kernel.org, jack@suse.cz, raven@themaw.net, miklos@szeredi.hu, neil@brown.name, a.hindborg@kernel.org, linux-mm@kvack.org, linux-efi@vger.kernel.org, ocfs2-devel@lists.linux.dev, kees@kernel.org, rostedt@goodmis.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, paul@paul-moore.com, casey@schaufler-ca.com, linuxppc-dev@lists.ozlabs.org, john.johansen@canonical.com, selinux@vger.kernel.org, borntraeger@linux.ibm.com, bpf@vger.kernel.org, clm@meta.com Subject: [PATCH v4 52/54] convert securityfs Date: Tue, 18 Nov 2025 05:16:01 +0000 Message-ID: <20251118051604.3868588-53-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20251118051604.3868588-1-viro@zeniv.linux.org.uk> References: <20251118051604.3868588-1-viro@zeniv.linux.org.uk> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Al Viro securityfs uses simple_recursive_removal(), but does not bother to mark dentries persistent. This is the only place where it still happens; get rid of that irregularity. * use simple_{start,done}_creating() and d_make_persitent(); kill_litter_super() use was already gone, since we empty the filesystem instance before it gets shut down. Acked-by: Paul Moore Signed-off-by: Al Viro --- security/inode.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/security/inode.c b/security/inode.c index bf7b5e2e6955..73df5db7f831 100644 --- a/security/inode.c +++ b/security/inode.c @@ -127,24 +127,19 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode, parent = mount->mnt_root; } - dir = d_inode(parent); - - inode_lock(dir); - dentry = lookup_noperm(&QSTR(name), parent); - if (IS_ERR(dentry)) + inode = new_inode(parent->d_sb); + if (unlikely(!inode)) { + dentry = ERR_PTR(-ENOMEM); goto out; - - if (d_really_is_positive(dentry)) { - error = -EEXIST; - goto out1; } - inode = new_inode(dir->i_sb); - if (!inode) { - error = -ENOMEM; - goto out1; - } + dir = d_inode(parent); + dentry = simple_start_creating(parent, name); + if (IS_ERR(dentry)) { + iput(inode); + goto out; + } inode->i_ino = get_next_ino(); inode->i_mode = mode; simple_inode_init_ts(inode); @@ -160,15 +155,11 @@ static struct dentry *securityfs_create_dentry(const char *name, umode_t mode, } else { inode->i_fop = fops; } - d_instantiate(dentry, inode); - inode_unlock(dir); - return dentry; + d_make_persistent(dentry, inode); + simple_done_creating(dentry); + return dentry; // borrowed -out1: - dput(dentry); - dentry = ERR_PTR(error); out: - inode_unlock(dir); if (pinned) simple_release_fs(&mount, &mount_count); return dentry; -- 2.47.3