From patchwork Mon Feb 24 21:20:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988961 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 BD2561D86E8 for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=hgeUbjJYDorV4b25xyzaAPTkHbL9b5I5twuPgkOpMqZ1Nb5zkttlemucFRYrLP9mkFXvb2K/h3TvQu8/uLi8IdW8why8wpa6A9zUqJCW/+sxJn08HlFGIxdQURjfeBlVezUB55IWoYIwKZXipmpl4ijjlqga3dveSyttsEOmMkw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=RYmn5R972EMoW46FoCrbjfqIQ2d6weOOnxiTtGpUrjk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Oqin1nvqM8gs5oenOpryeetwBThkxFY7PW7y4fBhLsYyVdp1a5YJMdNXsghdZ5aztwEy2kcz4zXAYQPb66xZjo/uVg9RSA7kADndUeb34itPPs6sinfZBGj/gVxf/z6QNmDSXANC1o+AKbDmiFjATikH0TIAU5gFK/rW6l4zrZ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=I7K6wl5s; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="I7K6wl5s" 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=dEwkjcQG/jmQpvWMbyrZsz6eAoqgmglkp0CU+P/pvLg=; b=I7K6wl5sXuqW8GGSg3njyN4GNA rIx8iFHv8gP1MFreDv0rcXYxrVBpIFzdzgSGqwJM2llDnM54hBbM2rQrINDFS8SF36OiI7QPIOrPf 77tkUBOKf5dxywpUYEsjPuhvlYKG9wH5+DZNCv8sNc58uLnmwxS4CdOKodEspZM2QZSeZUdL/RSJr SntwvU23ruJYw2QeEXeXvrnvRn8dtWjzeBO3qrTSvY+JVaSlUIEXle4ex/tRSqYNtCUdlzNoOQweT hk7uoyos/Ep4XpNTai2NZ1xKMQx58DtJt/646K5CmbJPBcu9S0Z7C0Bwv2uY3lbHLPt7SHr/Uc9a8 FuZklaXg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsh-00000007Mx2-3tKN; Mon, 24 Feb 2025 21:20:51 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 01/21] procfs: kill ->proc_dops Date: Mon, 24 Feb 2025 21:20:31 +0000 Message-ID: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224141444.GX1977892@ZenIV> References: <20250224141444.GX1977892@ZenIV> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro It has two possible values - one for "forced lookup" entries, another for the normal ones. We'd be better off with that as an explicit flag anyway and in addition to that it opens some fun possibilities with ->d_op and ->d_flags handling. Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/proc/generic.c | 8 +++++--- fs/proc/internal.h | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 8ec90826a49e..499c2bf67488 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -254,7 +254,10 @@ struct dentry *proc_lookup_de(struct inode *dir, struct dentry *dentry, inode = proc_get_inode(dir->i_sb, de); if (!inode) return ERR_PTR(-ENOMEM); - d_set_d_op(dentry, de->proc_dops); + if (de->flags & PROC_ENTRY_FORCE_LOOKUP) + d_set_d_op(dentry, &proc_net_dentry_ops); + else + d_set_d_op(dentry, &proc_misc_dentry_ops); return d_splice_alias(inode, dentry); } read_unlock(&proc_subdir_lock); @@ -448,9 +451,8 @@ static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent, INIT_LIST_HEAD(&ent->pde_openers); proc_set_user(ent, (*parent)->uid, (*parent)->gid); - ent->proc_dops = &proc_misc_dentry_ops; /* Revalidate everything under /proc/${pid}/net */ - if ((*parent)->proc_dops == &proc_net_dentry_ops) + if ((*parent)->flags & PROC_ENTRY_FORCE_LOOKUP) pde_force_lookup(ent); out: diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 1695509370b8..07f75c959173 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -44,7 +44,6 @@ struct proc_dir_entry { const struct proc_ops *proc_ops; const struct file_operations *proc_dir_ops; }; - const struct dentry_operations *proc_dops; union { const struct seq_operations *seq_ops; int (*single_show)(struct seq_file *, void *); @@ -67,6 +66,8 @@ struct proc_dir_entry { char inline_name[]; } __randomize_layout; +#define PROC_ENTRY_FORCE_LOOKUP 2 /* same space as PROC_ENTRY_PERMANENT */ + #define SIZEOF_PDE ( \ sizeof(struct proc_dir_entry) < 128 ? 128 : \ sizeof(struct proc_dir_entry) < 192 ? 192 : \ @@ -346,7 +347,7 @@ extern const struct dentry_operations proc_net_dentry_ops; static inline void pde_force_lookup(struct proc_dir_entry *pde) { /* /proc/net/ entries can be changed under us by setns(CLONE_NEWNET) */ - pde->proc_dops = &proc_net_dentry_ops; + pde->flags |= PROC_ENTRY_FORCE_LOOKUP; } /* From patchwork Mon Feb 24 21:20:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988958 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 BD3B61DAC81 for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; cv=none; b=HdjSo1iKQzk6uaa32cWEbj0n6ms84oGs9maI2QKne2c4ASoB57m4EHSXl7r1Cukot0it0fzoMJa8htUsS35EWxhl5A5XozO6mZW7Kv4G9qO+hnRhHld81Og+V6w7mwsv8aUotXiOYTyfSS4+W5ItqQ8o1791ztgRQJxzhbEIu+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; c=relaxed/simple; bh=5Y27ygzRBqQnBaUtl5iTCJpqzpGDuKFwnZMhhF0CCqg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U9+RM98um9QwRC6xZVEWV293kvRS0frmhSff1yPipQv8VHmlihOQK11ETEWmiLfywB2HYunl+kIfR+YVkBb4PCbXoN4m/lSIA4h+5RoXevYolxnv/o/DdDqSWk0OrDM0NiFPXG8O3RVQaaO5GE20EuUvmjHHJqwrUj3RM37bqq4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=qT56IP/q; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="qT56IP/q" 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=yN12Av02FX9my/OflwXc2GQXN8NvziMZsYZ+87a45qE=; b=qT56IP/qgsTTmbZFcWmE8dQMXM HXVoenpVd8lci3Xv3ehtN7cn0D/43qbSODWpvVxgi6GQ/xMWrniRxAmi5RcVqpCJh5zYkufPdnci6 UJ7E6JPCxPLgobgYaS4gHzPxMX1Jb54UPA29gAHG+2buesJ+xGNt6ccl4AW8ZtwYEbV6Y0e6h3zP6 ZnEUijtvY8e9yryOFF3VRrwXqSV4zsbR1jv0qUKWT9QakC2ECnKpSrOTlpOTsrOZyEKDnw+jDhxWI R38QNJbguvzx/CNbf7QdnuSpR1OXr4gXX4trAHvq/qGz9/XL5Hfy1jdhiTpM4b3Tl1pMJ1R8Ejdq3 A1HBFfOg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007Mx4-03HY; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 02/21] new helper: d_splice_alias_ops() Date: Mon, 24 Feb 2025 21:20:32 +0000 Message-ID: <20250224212051.1756517-2-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Uses of d_set_d_op() on live dentry can be very dangerous; it is going to be withdrawn and replaced with saner things. The best way for a filesystem is to have the default dentry_operations set at mount time and be done with that - __d_alloc() will use that. Currently there are two cases when d_set_d_op() is used on a live dentry - one is procfs, which has several genuinely different dentry_operations instances (different ->d_revalidate(), etc.) and another is simple_lookup(), where we would be better off without overriding ->d_op. For procfs we have d_set_d_op() calls followed by d_splice_alias(); provide a new helper (d_splice_alias_ops(inode, dentry, d_ops)) that would combine those two, and do the d_set_d_op() part while under ->d_lock. That eliminates one of the places where ->d_flags had been modified without holding ->d_lock; current behaviour is not racy, but the reasons for that are far too brittle. Better move to uniform locking rules and simpler proof of correctness... The next commit will convert procfs to use of that helper; it is not exported and won't be until somebody comes up with convincing modular user for it. Again, the best approach is to have default ->d_op and let __d_alloc() do the right thing; filesystem _may_ need non-uniform ->d_op (procfs does), but there'd better be good reasons for that. Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/dcache.c | 63 ++++++++++++++++++++++++------------------ include/linux/dcache.h | 3 ++ 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index e3634916ffb9..c85efbda133a 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2641,7 +2641,8 @@ EXPORT_SYMBOL(__d_lookup_unhash_wake); /* inode->i_lock held if inode is non-NULL */ -static inline void __d_add(struct dentry *dentry, struct inode *inode) +static inline void __d_add(struct dentry *dentry, struct inode *inode, + const struct dentry_operations *ops) { wait_queue_head_t *d_wait; struct inode *dir = NULL; @@ -2652,6 +2653,8 @@ static inline void __d_add(struct dentry *dentry, struct inode *inode) n = start_dir_add(dir); d_wait = __d_lookup_unhash(dentry); } + if (unlikely(ops)) + d_set_d_op(dentry, ops); if (inode) { unsigned add_flags = d_flags_for_inode(inode); hlist_add_head(&dentry->d_u.d_alias, &inode->i_dentry); @@ -2683,7 +2686,7 @@ void d_add(struct dentry *entry, struct inode *inode) security_d_instantiate(entry, inode); spin_lock(&inode->i_lock); } - __d_add(entry, inode); + __d_add(entry, inode, NULL); } EXPORT_SYMBOL(d_add); @@ -2981,30 +2984,8 @@ static int __d_unalias(struct dentry *dentry, struct dentry *alias) return ret; } -/** - * d_splice_alias - splice a disconnected dentry into the tree if one exists - * @inode: the inode which may have a disconnected dentry - * @dentry: a negative dentry which we want to point to the inode. - * - * If inode is a directory and has an IS_ROOT alias, then d_move that in - * place of the given dentry and return it, else simply d_add the inode - * to the dentry and return NULL. - * - * If a non-IS_ROOT directory is found, the filesystem is corrupt, and - * we should error out: directories can't have multiple aliases. - * - * This is needed in the lookup routine of any filesystem that is exportable - * (via knfsd) so that we can build dcache paths to directories effectively. - * - * If a dentry was found and moved, then it is returned. Otherwise NULL - * is returned. This matches the expected return value of ->lookup. - * - * Cluster filesystems may call this function with a negative, hashed dentry. - * In that case, we know that the inode will be a regular file, and also this - * will only occur during atomic_open. So we need to check for the dentry - * being already hashed only in the final case. - */ -struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) +struct dentry *d_splice_alias_ops(struct inode *inode, struct dentry *dentry, + const struct dentry_operations *ops) { if (IS_ERR(inode)) return ERR_CAST(inode); @@ -3050,9 +3031,37 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) } } out: - __d_add(dentry, inode); + __d_add(dentry, inode, ops); return NULL; } + +/** + * d_splice_alias - splice a disconnected dentry into the tree if one exists + * @inode: the inode which may have a disconnected dentry + * @dentry: a negative dentry which we want to point to the inode. + * + * If inode is a directory and has an IS_ROOT alias, then d_move that in + * place of the given dentry and return it, else simply d_add the inode + * to the dentry and return NULL. + * + * If a non-IS_ROOT directory is found, the filesystem is corrupt, and + * we should error out: directories can't have multiple aliases. + * + * This is needed in the lookup routine of any filesystem that is exportable + * (via knfsd) so that we can build dcache paths to directories effectively. + * + * If a dentry was found and moved, then it is returned. Otherwise NULL + * is returned. This matches the expected return value of ->lookup. + * + * Cluster filesystems may call this function with a negative, hashed dentry. + * In that case, we know that the inode will be a regular file, and also this + * will only occur during atomic_open. So we need to check for the dentry + * being already hashed only in the final case. + */ +struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) +{ + return d_splice_alias_ops(inode, dentry, NULL); +} EXPORT_SYMBOL(d_splice_alias); /* diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 4afb60365675..f47f3a47d97b 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -250,6 +250,9 @@ extern struct dentry * d_alloc_anon(struct super_block *); extern struct dentry * d_alloc_parallel(struct dentry *, const struct qstr *, wait_queue_head_t *); extern struct dentry * d_splice_alias(struct inode *, struct dentry *); +/* weird procfs mess; *NOT* exported */ +extern struct dentry * d_splice_alias_ops(struct inode *, struct dentry *, + const struct dentry_operations *); extern struct dentry * d_add_ci(struct dentry *, struct inode *, struct qstr *); extern bool d_same_name(const struct dentry *dentry, const struct dentry *parent, const struct qstr *name); From patchwork Mon Feb 24 21:20:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988957 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 A69D61F5FA for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; cv=none; b=B5JZluZ27/Vi8tSOvX2uYCb9e/XJCklnko5zqqKjyElEcBuimjhK/D23jsLYVau1fXhJF9ZJFC4w+lYh5fc4EN2UlG7tgxeynWuVX5zS4dL0QXXnO2F9oe2JYsuY4xDCtJLg+/umkFQrpnFBEYQ9sW6nU/PA/cTliT4kgjOR1s0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; c=relaxed/simple; bh=jtlp0VfbZ/3SrguKoHyOA0bSnjk+EOTFYZuz445Cd+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i283UQ4pdMLIilR1V85L4ksT6/ytU7oaq0hd5hg+q+YbRpMnIPlOS+YlT80xxijLJ/XTFszssv5pEw3mW75Sy6my1/SlTNSGnSINCXLsS8wnSFb9SswRb8OCnjn5xOgcTWlyajo2HoEj5NXWDXIlK73Tq4FaxoofwxE36lgfgZg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=tO/NUtOh; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="tO/NUtOh" 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=IdTDPUcIWdBr/qQLeQRgADe1QknsDH+5QhBxzfNUWOU=; b=tO/NUtOh/FfXEmaIDuo7ufQjXM QY3jrxjrf4qVT9UO29mkZYq+r8sAABOrsrsYFNmGQhn+9McXo8wM9XaaZ5TLW50WPri0KujkbPC4c qX+YuSu2CMoyiy0ALkzOrAyWebLrJ9EcEeUbgVWJ8tLE94WIevYAqdNzcY41UX85F22+PN62kBM98 Ux86fCDxstnZvuwkXh+83OtuJpqgjm+IN3cLTyj+Xv84waT3vznCZ3IKCALdo7PxCM0N39hx8fllC 2rEicpPlJeG8QyM9Xy+NdvTZybGWT30s3sE/6on+utXLyhNswdZul98dWeHz5g/F+3iVOta/pmN6o /y+xmj3g==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007Mx6-0GLW; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 03/21] switch procfs from d_set_d_op() to d_splice_alias_ops() Date: Mon, 24 Feb 2025 21:20:33 +0000 Message-ID: <20250224212051.1756517-3-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/proc/base.c | 9 +++------ fs/proc/generic.c | 8 ++++---- fs/proc/internal.h | 3 +-- fs/proc/namespaces.c | 3 +-- fs/proc/proc_sysctl.c | 7 +++---- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index cd89e956c322..397a9f6f463e 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2709,8 +2709,7 @@ static struct dentry *proc_pident_instantiate(struct dentry *dentry, inode->i_fop = p->fop; ei->op = p->op; pid_update_inode(task, inode); - d_set_d_op(dentry, &pid_dentry_operations); - return d_splice_alias(inode, dentry); + return d_splice_alias_ops(inode, dentry, &pid_dentry_operations); } static struct dentry *proc_pident_lookup(struct inode *dir, @@ -3508,8 +3507,7 @@ static struct dentry *proc_pid_instantiate(struct dentry * dentry, set_nlink(inode, nlink_tgid); pid_update_inode(task, inode); - d_set_d_op(dentry, &pid_dentry_operations); - return d_splice_alias(inode, dentry); + return d_splice_alias_ops(inode, dentry, &pid_dentry_operations); } struct dentry *proc_pid_lookup(struct dentry *dentry, unsigned int flags) @@ -3813,8 +3811,7 @@ static struct dentry *proc_task_instantiate(struct dentry *dentry, set_nlink(inode, nlink_tid); pid_update_inode(task, inode); - d_set_d_op(dentry, &pid_dentry_operations); - return d_splice_alias(inode, dentry); + return d_splice_alias_ops(inode, dentry, &pid_dentry_operations); } static struct dentry *proc_task_lookup(struct inode *dir, struct dentry * dentry, unsigned int flags) diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 499c2bf67488..774e18372914 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -255,10 +255,10 @@ struct dentry *proc_lookup_de(struct inode *dir, struct dentry *dentry, if (!inode) return ERR_PTR(-ENOMEM); if (de->flags & PROC_ENTRY_FORCE_LOOKUP) - d_set_d_op(dentry, &proc_net_dentry_ops); - else - d_set_d_op(dentry, &proc_misc_dentry_ops); - return d_splice_alias(inode, dentry); + return d_splice_alias_ops(inode, dentry, + &proc_net_dentry_ops); + return d_splice_alias_ops(inode, dentry, + &proc_misc_dentry_ops); } read_unlock(&proc_subdir_lock); return ERR_PTR(-ENOENT); diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 07f75c959173..48410381036b 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -358,7 +358,6 @@ static inline void pde_force_lookup(struct proc_dir_entry *pde) static inline struct dentry *proc_splice_unmountable(struct inode *inode, struct dentry *dentry, const struct dentry_operations *d_ops) { - d_set_d_op(dentry, d_ops); dont_mount(dentry); - return d_splice_alias(inode, dentry); + return d_splice_alias_ops(inode, dentry, d_ops); } diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c index c610224faf10..4403a2e20c16 100644 --- a/fs/proc/namespaces.c +++ b/fs/proc/namespaces.c @@ -111,8 +111,7 @@ static struct dentry *proc_ns_instantiate(struct dentry *dentry, ei->ns_ops = ns_ops; pid_update_inode(task, inode); - d_set_d_op(dentry, &pid_dentry_operations); - return d_splice_alias(inode, dentry); + return d_splice_alias_ops(inode, dentry, &pid_dentry_operations); } static int proc_ns_dir_readdir(struct file *file, struct dir_context *ctx) diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index cc9d74a06ff0..7a8bffc03dc8 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c @@ -540,9 +540,8 @@ static struct dentry *proc_sys_lookup(struct inode *dir, struct dentry *dentry, goto out; } - d_set_d_op(dentry, &proc_sys_dentry_operations); inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p); - err = d_splice_alias(inode, dentry); + err = d_splice_alias_ops(inode, dentry, &proc_sys_dentry_operations); out: if (h) @@ -699,9 +698,9 @@ static bool proc_sys_fill_cache(struct file *file, return false; if (d_in_lookup(child)) { struct dentry *res; - d_set_d_op(child, &proc_sys_dentry_operations); inode = proc_sys_make_inode(dir->d_sb, head, table); - res = d_splice_alias(inode, child); + res = d_splice_alias_ops(inode, child, + &proc_sys_dentry_operations); d_lookup_done(child); if (unlikely(res)) { dput(child); From patchwork Mon Feb 24 21:20:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988955 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 BD2D21D9A79 for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; cv=none; b=f0KuXQ+6i1WhOw+HidpeUrdqht2/TUuLq/4GffQUFohLQFhFloVzFhfoxiKfDkjn7BOMQ2VwTMId6nwQi15VMViS9i+aNr8V7lDhbAKQCchr1Sezc0+5AlS32Z9FF1/xSK2mD3Sfh2NnddJRV8Ik+k+9GZDtZw0M72eEJ8DfUos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; c=relaxed/simple; bh=ZV7yAoiQLs1+UjVXs8H9EhGvXY10O+mRXKqQqhSlnkA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QkUt619jovrpLWm8U84BNQHOj2g74akKPWNVijgLxqTo0PJiN4NP2bun/Z/pt7YIe+oVNFbf+WjalidQ+bXUmtZCGaFQMTxpZ0p/Py8PEcw+YKlDPdAhS+eZDoPnQJpt1S4dGkeRtfXyX9Z9OTM3JNZcodwiIY0ZWEOy/AuD6dQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=WaFiY0xs; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="WaFiY0xs" 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=cD0QyUmsDMX3U0Nt5e+64XvmDN00y3Jrngvt56dwu8Y=; b=WaFiY0xsXC6584uNQ3Usb7O01c OEUnE20K7wT5XMOwYThNJjl9jH8wuqbnwthypd0hzx2cjXm1+WC3L7MROtkrYvVUmu1pXiT+bJ9k7 ppi8Ab+nDJHs2FszYaQKnoEWpaV4nT5DPC+Lr0aVolP8LY9Pnj4h0purFaC2pzjEWVcl88UBhUJsg pkVElusC2lNGH5gKfSaIWet2m2tyjtdyC6weOXHPcHAIywzepzzM1mI2hcrx1NDMB8RNBdsgWjd+t TO9+qaV+/ETI1Oqd3C+wuN8e4px6bnjiiuXyWF77i1wGPSGbcTNqVWyA9JeeBcOZAhS1fS+VEvdfZ dAuNHW7A==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007Mx9-0YPa; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 04/21] fuse: no need for special dentry_operations for root dentry Date: Mon, 24 Feb 2025 21:20:34 +0000 Message-ID: <20250224212051.1756517-4-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro ->d_revalidate() is never called for root anyway... Signed-off-by: Al Viro Reviewed-by: Christian Brauner Acked-by: Miklos Szeredi --- fs/fuse/dir.c | 7 ------- fs/fuse/fuse_i.h | 1 - fs/fuse/inode.c | 4 +--- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 198862b086ff..24979d5413fa 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -336,13 +336,6 @@ const struct dentry_operations fuse_dentry_operations = { .d_automount = fuse_dentry_automount, }; -const struct dentry_operations fuse_root_dentry_operations = { -#if BITS_PER_LONG < 64 - .d_init = fuse_dentry_init, - .d_release = fuse_dentry_release, -#endif -}; - int fuse_valid_type(int m) { return S_ISREG(m) || S_ISDIR(m) || S_ISLNK(m) || S_ISCHR(m) || diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index fee96fe7887b..71a2b3900854 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -1069,7 +1069,6 @@ static inline void fuse_sync_bucket_dec(struct fuse_sync_bucket *bucket) extern const struct file_operations fuse_dev_operations; extern const struct dentry_operations fuse_dentry_operations; -extern const struct dentry_operations fuse_root_dentry_operations; /** * Get a filled in inode diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index e9db2cb8c150..57a1ee016b73 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1800,12 +1800,10 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx) err = -ENOMEM; root = fuse_get_root_inode(sb, ctx->rootmode); - sb->s_d_op = &fuse_root_dentry_operations; + sb->s_d_op = &fuse_dentry_operations; root_dentry = d_make_root(root); if (!root_dentry) goto err_dev_free; - /* Root dentry doesn't have .d_revalidate */ - sb->s_d_op = &fuse_dentry_operations; mutex_lock(&fuse_mutex); err = -EINVAL; From patchwork Mon Feb 24 21:20:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988960 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 BD3321DA617 for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=MUlauCvQbDr2Ti3cdYiV7J76IZQxbLF0IIdxoK3ytb7UNQKHGndyvr303zL5K+385tl6Mx4tcqWk4W7cYGyVBhE79hsdkJdwIthnHH9R6dq85kbQ3vC5DRxaFXqgKW0NtAsQ+MaE9MLaCDF5Oe54Y/BYbpcO21f2XEd25ngeWh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=8z+7LuDmMYC85MHOtTbAhdf3Xr5A+BMUrnUy4Jrn+V0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LQ4DFu+tlwiOJBnTqcHtnEIFDKZdPUrCLfK7s0V8/5JqODEpN85jw4zktiwJSXqTgLdDEX3qg/bzN0hGOejVqZILGf5daUpcSMQXHWT4MhLaGHm091UetbOtMWophuw2Kd3mq6rowIxPudnOjtpW5i2+E8hQWs8+FmbdWweP8+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=qYtHUna7; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="qYtHUna7" 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=UgZkrL1KyAjreevqcKTv5goJMKDcFvaMWdPc02RN/cY=; b=qYtHUna7mrg51JawXlKUa2IIxC ZEY4JZBK/uRLQcAX1YA3mMyd6P5cYwLK2sMb16sKYe8ZtEvMZGO7LebgoBuafBgbXW9V0BjmINDd+ JWmR4fOtEBvIqvIScCdXMcVK46gjKO1/O+hkC33vlw2MiIuahvrQsEdpgX8Ee7FOwDduvIMGMPBST iMJZZgE40J6taZYWONkMhIY6vBJDIBv63AMGlWtskIK0kredLfJIcTyRjYmaUgQW2lSfGLr5X7T2f XS/v6AX1swPnJdD0kCS//hDtSL2V2tXzVMGBxS3iniApSFBVM6h0XMsYHt0fbsN+m689/W+Dz6d9r 8VYJcA1A==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007MxB-0m1U; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 05/21] new helper: set_default_d_op() Date: Mon, 24 Feb 2025 21:20:35 +0000 Message-ID: <20250224212051.1756517-5-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro ... to be used instead of manually assigning to ->s_d_op. All in-tree filesystem converted (and field itself is renamed, so any out-of-tree ones in need of conversion will be caught by compiler). Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- Documentation/filesystems/porting.rst | 7 +++++++ fs/9p/vfs_super.c | 4 ++-- fs/adfs/super.c | 2 +- fs/affs/super.c | 4 ++-- fs/afs/super.c | 4 ++-- fs/autofs/inode.c | 2 +- fs/btrfs/super.c | 2 +- fs/ceph/super.c | 2 +- fs/coda/inode.c | 2 +- fs/configfs/mount.c | 2 +- fs/dcache.c | 10 ++++++++-- fs/debugfs/inode.c | 2 +- fs/devpts/inode.c | 2 +- fs/ecryptfs/main.c | 2 +- fs/efivarfs/super.c | 2 +- fs/exfat/super.c | 4 ++-- fs/fat/namei_msdos.c | 2 +- fs/fat/namei_vfat.c | 4 ++-- fs/fuse/inode.c | 4 ++-- fs/gfs2/ops_fstype.c | 2 +- fs/hfs/super.c | 2 +- fs/hfsplus/super.c | 2 +- fs/hostfs/hostfs_kern.c | 2 +- fs/hpfs/super.c | 2 +- fs/isofs/inode.c | 2 +- fs/jfs/super.c | 2 +- fs/kernfs/mount.c | 2 +- fs/libfs.c | 16 ++++++++-------- fs/nfs/super.c | 2 +- fs/ntfs3/super.c | 3 ++- fs/ocfs2/super.c | 2 +- fs/orangefs/super.c | 2 +- fs/overlayfs/super.c | 2 +- fs/smb/client/cifsfs.c | 4 ++-- fs/tracefs/inode.c | 2 +- fs/vboxsf/super.c | 2 +- include/linux/dcache.h | 2 ++ include/linux/fs.h | 2 +- mm/shmem.c | 2 +- net/sunrpc/rpc_pipe.c | 2 +- 40 files changed, 69 insertions(+), 53 deletions(-) diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst index 1639e78e3146..004cd69617a2 100644 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -1157,3 +1157,10 @@ in normal case it points into the pathname being looked up. NOTE: if you need something like full path from the root of filesystem, you are still on your own - this assists with simple cases, but it's not magic. + +--- + +**mandatory** + +If your filesystem sets the default dentry_operations, use set_default_d_op() +rather than manually setting sb->s_d_op. diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 489db161abc9..5c3dc3efb909 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -135,9 +135,9 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, goto release_sb; if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) - sb->s_d_op = &v9fs_cached_dentry_operations; + set_default_d_op(sb, &v9fs_cached_dentry_operations); else - sb->s_d_op = &v9fs_dentry_operations; + set_default_d_op(sb, &v9fs_dentry_operations); inode = v9fs_get_new_inode_from_fid(v9ses, fid, sb); if (IS_ERR(inode)) { diff --git a/fs/adfs/super.c b/fs/adfs/super.c index 017c48a80203..fdccdbbfc213 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c @@ -397,7 +397,7 @@ static int adfs_fill_super(struct super_block *sb, struct fs_context *fc) if (asb->s_ftsuffix) asb->s_namelen += 4; - sb->s_d_op = &adfs_dentry_operations; + set_default_d_op(sb, &adfs_dentry_operations); root = adfs_iget(sb, &root_obj); sb->s_root = d_make_root(root); if (!sb->s_root) { diff --git a/fs/affs/super.c b/fs/affs/super.c index 2fa40337776d..44f8aa883100 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -500,9 +500,9 @@ static int affs_fill_super(struct super_block *sb, struct fs_context *fc) return PTR_ERR(root_inode); if (affs_test_opt(AFFS_SB(sb)->s_flags, SF_INTL)) - sb->s_d_op = &affs_intl_dentry_operations; + set_default_d_op(sb, &affs_intl_dentry_operations); else - sb->s_d_op = &affs_dentry_operations; + set_default_d_op(sb, &affs_dentry_operations); sb->s_root = d_make_root(root_inode); if (!sb->s_root) { diff --git a/fs/afs/super.c b/fs/afs/super.c index a9bee610674e..13d0414a1ddb 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c @@ -487,12 +487,12 @@ static int afs_fill_super(struct super_block *sb, struct afs_fs_context *ctx) goto error; if (as->dyn_root) { - sb->s_d_op = &afs_dynroot_dentry_operations; + set_default_d_op(sb, &afs_dynroot_dentry_operations); ret = afs_dynroot_populate(sb); if (ret < 0) goto error; } else { - sb->s_d_op = &afs_fs_dentry_operations; + set_default_d_op(sb, &afs_fs_dentry_operations); rcu_assign_pointer(as->volume->sb, sb); } diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c index ee2edccaef70..f5c16ffba013 100644 --- a/fs/autofs/inode.c +++ b/fs/autofs/inode.c @@ -311,7 +311,7 @@ static int autofs_fill_super(struct super_block *s, struct fs_context *fc) s->s_blocksize_bits = 10; s->s_magic = AUTOFS_SUPER_MAGIC; s->s_op = &autofs_sops; - s->s_d_op = &autofs_dentry_operations; + set_default_d_op(s, &autofs_dentry_operations); s->s_time_gran = 1; /* diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index dc4fee519ca6..5f39857ea3ae 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -954,7 +954,7 @@ static int btrfs_fill_super(struct super_block *sb, sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_magic = BTRFS_SUPER_MAGIC; sb->s_op = &btrfs_super_ops; - sb->s_d_op = &btrfs_dentry_operations; + set_default_d_op(sb, &btrfs_dentry_operations); sb->s_export_op = &btrfs_export_ops; #ifdef CONFIG_FS_VERITY sb->s_vop = &btrfs_verityops; diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 4344e1f11806..adec6e2f01c4 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -1220,7 +1220,7 @@ static int ceph_set_super(struct super_block *s, struct fs_context *fc) fsc->max_file_size = 1ULL << 40; /* temp value until we get mdsmap */ s->s_op = &ceph_super_ops; - s->s_d_op = &ceph_dentry_ops; + set_default_d_op(s, &ceph_dentry_ops); s->s_export_op = &ceph_export_ops; s->s_time_gran = 1; diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 6896fce122e1..08450d006016 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -230,7 +230,7 @@ static int coda_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize_bits = 12; sb->s_magic = CODA_SUPER_MAGIC; sb->s_op = &coda_super_operations; - sb->s_d_op = &coda_dentry_operations; + set_default_d_op(sb, &coda_dentry_operations); sb->s_time_gran = 1; sb->s_time_min = S64_MIN; sb->s_time_max = S64_MAX; diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index c2d820063ec4..20412eaca972 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c @@ -92,7 +92,7 @@ static int configfs_fill_super(struct super_block *sb, struct fs_context *fc) configfs_root_group.cg_item.ci_dentry = root; root->d_fsdata = &configfs_root; sb->s_root = root; - sb->s_d_op = &configfs_dentry_ops; /* the rest get that */ + set_default_d_op(sb, &configfs_dentry_ops); /* the rest get that */ return 0; } diff --git a/fs/dcache.c b/fs/dcache.c index c85efbda133a..cd5e5139ca4c 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1712,7 +1712,7 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) INIT_HLIST_HEAD(&dentry->d_children); INIT_HLIST_NODE(&dentry->d_u.d_alias); INIT_HLIST_NODE(&dentry->d_sib); - d_set_d_op(dentry, dentry->d_sb->s_d_op); + d_set_d_op(dentry, dentry->d_sb->__s_d_op); if (dentry->d_op && dentry->d_op->d_init) { err = dentry->d_op->d_init(dentry); @@ -1795,7 +1795,7 @@ struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name) struct dentry *dentry = __d_alloc(sb, name); if (likely(dentry)) { dentry->d_flags |= DCACHE_NORCU; - if (!sb->s_d_op) + if (!dentry->d_op) d_set_d_op(dentry, &anon_ops); } return dentry; @@ -1841,6 +1841,12 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) } EXPORT_SYMBOL(d_set_d_op); +void set_default_d_op(struct super_block *s, const struct dentry_operations *ops) +{ + s->__s_d_op = ops; +} +EXPORT_SYMBOL(set_default_d_op); + static unsigned d_flags_for_inode(struct inode *inode) { unsigned add_flags = DCACHE_REGULAR_TYPE; diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 75715d8877ee..f54a8fd960e4 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -273,7 +273,7 @@ static int debugfs_fill_super(struct super_block *sb, struct fs_context *fc) return err; sb->s_op = &debugfs_super_operations; - sb->s_d_op = &debugfs_dops; + set_default_d_op(sb, &debugfs_dops); debugfs_apply_options(sb); diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 1096ff8562fa..f092973236ef 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -433,7 +433,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent) s->s_blocksize_bits = 10; s->s_magic = DEVPTS_SUPER_MAGIC; s->s_op = &devpts_sops; - s->s_d_op = &simple_dentry_operations; + set_default_d_op(s, &simple_dentry_operations); s->s_time_gran = 1; error = -ENOMEM; diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 8dd1d7189c3b..45f9ca4465da 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c @@ -471,7 +471,7 @@ static int ecryptfs_get_tree(struct fs_context *fc) sbi = NULL; s->s_op = &ecryptfs_sops; s->s_xattr = ecryptfs_xattr_handlers; - s->s_d_op = &ecryptfs_dops; + set_default_d_op(s, &ecryptfs_dops); err = "Reading sb failed"; rc = kern_path(fc->source, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path); diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 09fcf731e65d..3f3188e0cfa7 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -345,7 +345,7 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize_bits = PAGE_SHIFT; sb->s_magic = EFIVARFS_MAGIC; sb->s_op = &efivarfs_ops; - sb->s_d_op = &efivarfs_d_ops; + set_default_d_op(sb, &efivarfs_d_ops); sb->s_time_gran = 1; if (!efivar_supports_writes()) diff --git a/fs/exfat/super.c b/fs/exfat/super.c index bd57844414aa..c821582fa1ef 100644 --- a/fs/exfat/super.c +++ b/fs/exfat/super.c @@ -697,9 +697,9 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc) } if (sbi->options.utf8) - sb->s_d_op = &exfat_utf8_dentry_ops; + set_default_d_op(sb, &exfat_utf8_dentry_ops); else - sb->s_d_op = &exfat_dentry_ops; + set_default_d_op(sb, &exfat_dentry_ops); root_inode = new_inode(sb); if (!root_inode) { diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index f06f6ba643cc..71302291d33c 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c @@ -646,7 +646,7 @@ static const struct inode_operations msdos_dir_inode_operations = { static void setup(struct super_block *sb) { MSDOS_SB(sb)->dir_ops = &msdos_dir_inode_operations; - sb->s_d_op = &msdos_dentry_operations; + set_default_d_op(sb, &msdos_dentry_operations); sb->s_flags |= SB_NOATIME; } diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index 926c26e90ef8..2476afd1304d 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c @@ -1187,9 +1187,9 @@ static void setup(struct super_block *sb) { MSDOS_SB(sb)->dir_ops = &vfat_dir_inode_operations; if (MSDOS_SB(sb)->options.name_check != 's') - sb->s_d_op = &vfat_ci_dentry_ops; + set_default_d_op(sb, &vfat_ci_dentry_ops); else - sb->s_d_op = &vfat_dentry_ops; + set_default_d_op(sb, &vfat_dentry_ops); } static int vfat_fill_super(struct super_block *sb, struct fs_context *fc) diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 57a1ee016b73..9994f3b33a9f 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -1665,7 +1665,7 @@ static int fuse_fill_super_submount(struct super_block *sb, fi = get_fuse_inode(root); fi->nlookup--; - sb->s_d_op = &fuse_dentry_operations; + set_default_d_op(sb, &fuse_dentry_operations); sb->s_root = d_make_root(root); if (!sb->s_root) return -ENOMEM; @@ -1800,7 +1800,7 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx) err = -ENOMEM; root = fuse_get_root_inode(sb, ctx->rootmode); - sb->s_d_op = &fuse_dentry_operations; + set_default_d_op(sb, &fuse_dentry_operations); root_dentry = d_make_root(root); if (!root_dentry) goto err_dev_free; diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index e83d293c3614..949bbdb5b564 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1156,7 +1156,7 @@ static int gfs2_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_flags |= SB_NOSEC; sb->s_magic = GFS2_MAGIC; sb->s_op = &gfs2_super_ops; - sb->s_d_op = &gfs2_dops; + set_default_d_op(sb, &gfs2_dops); sb->s_export_op = &gfs2_export_ops; sb->s_qcop = &gfs2_quotactl_ops; sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP; diff --git a/fs/hfs/super.c b/fs/hfs/super.c index fe09c2093a93..388a318297ec 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c @@ -365,7 +365,7 @@ static int hfs_fill_super(struct super_block *sb, struct fs_context *fc) if (!root_inode) goto bail_no_root; - sb->s_d_op = &hfs_dentry_operations; + set_default_d_op(sb, &hfs_dentry_operations); res = -ENOMEM; sb->s_root = d_make_root(root_inode); if (!sb->s_root) diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 948b8aaee33e..0caf7aa1c249 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -508,7 +508,7 @@ static int hfsplus_fill_super(struct super_block *sb, struct fs_context *fc) goto out_put_alloc_file; } - sb->s_d_op = &hfsplus_dentry_operations; + set_default_d_op(sb, &hfsplus_dentry_operations); sb->s_root = d_make_root(root); if (!sb->s_root) { err = -ENOMEM; diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index e0741e468956..a0e0563a29d7 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -920,7 +920,7 @@ static int hostfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize_bits = 10; sb->s_magic = HOSTFS_SUPER_MAGIC; sb->s_op = &hostfs_sbops; - sb->s_d_op = &simple_dentry_operations; + set_default_d_op(sb, &simple_dentry_operations); sb->s_maxbytes = MAX_LFS_FILESIZE; err = super_setup_bdi(sb); if (err) diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 27567920abe4..42b779b4d87f 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c @@ -554,7 +554,7 @@ static int hpfs_fill_super(struct super_block *s, struct fs_context *fc) /* Fill superblock stuff */ s->s_magic = HPFS_SUPER_MAGIC; s->s_op = &hpfs_sops; - s->s_d_op = &hpfs_dentry_operations; + set_default_d_op(s, &hpfs_dentry_operations); s->s_time_min = local_to_gmt(s, 0); s->s_time_max = local_to_gmt(s, U32_MAX); diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 47038e660812..05ddc2544ade 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -939,7 +939,7 @@ static int isofs_fill_super(struct super_block *s, struct fs_context *fc) sbi->s_check = opt->check; if (table) - s->s_d_op = &isofs_dentry_ops[table - 1]; + set_default_d_op(s, &isofs_dentry_ops[table - 1]); /* get the root dentry */ s->s_root = d_make_root(inode); diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 223d9ac59839..10c3cb714423 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c @@ -542,7 +542,7 @@ static int jfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_magic = JFS_SUPER_MAGIC; if (sbi->mntflag & JFS_OS2) - sb->s_d_op = &jfs_ci_dentry_operations; + set_default_d_op(sb, &jfs_ci_dentry_operations); inode = jfs_iget(sb, ROOT_I); if (IS_ERR(inode)) { diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c index 1358c21837f1..91e788d15073 100644 --- a/fs/kernfs/mount.c +++ b/fs/kernfs/mount.c @@ -281,7 +281,7 @@ static int kernfs_fill_super(struct super_block *sb, struct kernfs_fs_context *k return -ENOMEM; } sb->s_root = root; - sb->s_d_op = &kernfs_dops; + set_default_d_op(sb, &kernfs_dops); return 0; } diff --git a/fs/libfs.c b/fs/libfs.c index 8444f5cc4064..929bef0fecbd 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -75,7 +75,7 @@ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned { if (dentry->d_name.len > NAME_MAX) return ERR_PTR(-ENAMETOOLONG); - if (!dentry->d_sb->s_d_op) + if (!dentry->d_op) d_set_d_op(dentry, &simple_dentry_operations); if (IS_ENABLED(CONFIG_UNICODE) && IS_CASEFOLDED(dir)) @@ -683,7 +683,7 @@ static int pseudo_fs_fill_super(struct super_block *s, struct fs_context *fc) s->s_root = d_make_root(root); if (!s->s_root) return -ENOMEM; - s->s_d_op = ctx->dops; + set_default_d_op(s, ctx->dops); return 0; } @@ -1943,22 +1943,22 @@ static const struct dentry_operations generic_encrypted_dentry_ops = { * @sb: superblock to be configured * * Filesystems supporting casefolding and/or fscrypt can call this - * helper at mount-time to configure sb->s_d_op to best set of dentry - * operations required for the enabled features. The helper must be - * called after these have been configured, but before the root dentry - * is created. + * helper at mount-time to configure default dentry_operations to the + * best set of dentry operations required for the enabled features. + * The helper must be called after these have been configured, but + * before the root dentry is created. */ void generic_set_sb_d_ops(struct super_block *sb) { #if IS_ENABLED(CONFIG_UNICODE) if (sb->s_encoding) { - sb->s_d_op = &generic_ci_dentry_ops; + set_default_d_op(sb, &generic_ci_dentry_ops); return; } #endif #ifdef CONFIG_FS_ENCRYPTION if (sb->s_cop) { - sb->s_d_op = &generic_encrypted_dentry_ops; + set_default_d_op(sb, &generic_encrypted_dentry_ops); return; } #endif diff --git a/fs/nfs/super.c b/fs/nfs/super.c index aeb715b4a690..38b0ecf02ad6 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -1169,7 +1169,7 @@ static int nfs_set_super(struct super_block *s, struct fs_context *fc) struct nfs_server *server = fc->s_fs_info; int ret; - s->s_d_op = server->nfs_client->rpc_ops->dentry_ops; + set_default_d_op(s, server->nfs_client->rpc_ops->dentry_ops); ret = set_anon_super(s, server); if (ret == 0) server->s_dev = s->s_dev; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 6a0f6b0a3ab2..90f5361ae13f 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -1182,7 +1182,8 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_export_op = &ntfs_export_ops; sb->s_time_gran = NTFS_TIME_GRAN; // 100 nsec sb->s_xattr = ntfs_xattr_handlers; - sb->s_d_op = options->nocase ? &ntfs_dentry_ops : NULL; + if (options->nocase) + set_default_d_op(sb, &ntfs_dentry_ops); options->nls = ntfs_load_nls(options->nls_name); if (IS_ERR(options->nls)) { diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 8bb5022f3082..411f72be4a9b 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1959,7 +1959,7 @@ static int ocfs2_initialize_super(struct super_block *sb, sb->s_fs_info = osb; sb->s_op = &ocfs2_sops; - sb->s_d_op = &ocfs2_dentry_ops; + set_default_d_op(sb, &ocfs2_dentry_ops); sb->s_export_op = &ocfs2_export_ops; sb->s_qcop = &dquot_quotactl_sysfile_ops; sb->dq_op = &ocfs2_quota_operations; diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index eba3e357192e..d4c8d8b32f14 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -434,7 +434,7 @@ static int orangefs_fill_sb(struct super_block *sb, sb->s_xattr = orangefs_xattr_handlers; sb->s_magic = ORANGEFS_SUPER_MAGIC; sb->s_op = &orangefs_s_ops; - sb->s_d_op = &orangefs_dentry_operations; + set_default_d_op(sb, &orangefs_dentry_operations); sb->s_blocksize = PAGE_SIZE; sb->s_blocksize_bits = PAGE_SHIFT; diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 86ae6f6da36b..5f7a5a8c0778 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -1315,7 +1315,7 @@ int ovl_fill_super(struct super_block *sb, struct fs_context *fc) if (WARN_ON(fc->user_ns != current_user_ns())) goto out_err; - sb->s_d_op = &ovl_dentry_operations; + set_default_d_op(sb, &ovl_dentry_operations); err = -ENOMEM; ofs->creator_cred = cred = prepare_creds(); diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index 6a3bd652d251..5ba1046d1e5a 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -261,9 +261,9 @@ cifs_read_super(struct super_block *sb) } if (tcon->nocase) - sb->s_d_op = &cifs_ci_dentry_ops; + set_default_d_op(sb, &cifs_ci_dentry_ops); else - sb->s_d_op = &cifs_dentry_ops; + set_default_d_op(sb, &cifs_dentry_ops); sb->s_root = d_make_root(inode); if (!sb->s_root) { diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index 53214499e384..30a951133831 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c @@ -480,7 +480,7 @@ static int tracefs_fill_super(struct super_block *sb, struct fs_context *fc) return err; sb->s_op = &tracefs_super_operations; - sb->s_d_op = &tracefs_dentry_operations; + set_default_d_op(sb, &tracefs_dentry_operations); return 0; } diff --git a/fs/vboxsf/super.c b/fs/vboxsf/super.c index 1d94bb784108..46eea52beb23 100644 --- a/fs/vboxsf/super.c +++ b/fs/vboxsf/super.c @@ -190,7 +190,7 @@ static int vboxsf_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize = 1024; sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_op = &vboxsf_super_ops; - sb->s_d_op = &vboxsf_dentry_ops; + set_default_d_op(sb, &vboxsf_dentry_ops); iroot = iget_locked(sb, 0); if (!iroot) { diff --git a/include/linux/dcache.h b/include/linux/dcache.h index f47f3a47d97b..e8cf1d0fdd08 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -619,4 +619,6 @@ static inline struct dentry *d_next_sibling(const struct dentry *dentry) return hlist_entry_safe(dentry->d_sib.next, struct dentry, d_sib); } +void set_default_d_op(struct super_block *, const struct dentry_operations *); + #endif /* __LINUX_DCACHE_H */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 2c3b2f8a621f..23fd8b0d4e81 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1405,7 +1405,7 @@ struct super_block { */ const char *s_subtype; - const struct dentry_operations *s_d_op; /* default d_op for dentries */ + const struct dentry_operations *__s_d_op; /* default d_op for dentries */ struct shrinker *s_shrink; /* per-sb shrinker handle */ diff --git a/mm/shmem.c b/mm/shmem.c index 4ea6109a8043..0ecb49113bb2 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -5019,7 +5019,7 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc) if (ctx->encoding) { sb->s_encoding = ctx->encoding; - sb->s_d_op = &shmem_ci_dentry_ops; + set_default_d_op(sb, &shmem_ci_dentry_ops); if (ctx->strict_encoding) sb->s_encoding_flags = SB_ENC_STRICT_MODE_FL; } diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index eadc00410ebc..e093e4cf20fa 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -1363,7 +1363,7 @@ rpc_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize_bits = PAGE_SHIFT; sb->s_magic = RPCAUTH_GSSMAGIC; sb->s_op = &s_ops; - sb->s_d_op = &simple_dentry_operations; + set_default_d_op(sb, &simple_dentry_operations); sb->s_time_gran = 1; inode = rpc_get_inode(sb, S_IFDIR | 0555); From patchwork Mon Feb 24 21:20:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988954 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 AACE41CEAB2 for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432055; cv=none; b=qpwAeMKQqrAVFp6IAYOt1BBO60jyw29TcIfAKl6bdDNL2bc0RFHpCYTbYzVuf2cdQxDyunF7qzqeZpu6oH5FnujyeFdnK63bYqzhSYNbKl+wrzfZkc9HyfeinEBPFl733NQiN8FJ+KZCH06WuRp97SP3j1RmuVCZOe5IwZ4YYB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432055; c=relaxed/simple; bh=Wo4txn4dmfTosxRG3rec1YPlAWcZ/wrr91Tw3E/adLI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bkPcBdqE6YSgD4T9NWwu02VYNX/A8Mz5gQFumMqdTXJvnbQ5mOrjepvGDMe3FCdUqEZ1hyWC21FktQrdgOMCZ14bP31r/PazXaxFkWsLs7HVj9Ga8w7m+XUDbyHS0MawaPUvcIZITFE27Xaes7CAGDp7zHDQ+WN71ADJxfHvsaY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=CJalFdNN; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="CJalFdNN" 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=1F2/4S/8rFQLWDEOOs31eSIJSfaZ7JG59EE/HaotUwo=; b=CJalFdNNQRGHbWO0lOf7EsLQ7F +sujPZSdSc11pSNwKi/+Ebp/7OJkaQX8io1L2UDE4+0gfwqSUlqn2Mn61dWnldGKxDj6S1IXI//e1 kDbcRLsRr3IVf0kxrGeWqkwtMvXbqCse8BjHfa7jxM7gvuE5IcoVEyF3fqrA7p2aQD5yTLXjN11GV 8d3/6NZlqyk5YlD3CB/v7u55wLMEBnQdnAzUtBlF9zTHSSVrIIRRJYcK42fh1+kMfLMseqfbwx81z 1VWmafsGW8PFISv9Do2HDjxV4+c7eGip5OQWPiuiseHz+Nxfuh91uLaRVJwT91n1k1Di2JDrhv0qG RUv10HCw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007MxD-1JJP; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 06/21] split d_flags calculation out of d_set_d_op() Date: Mon, 24 Feb 2025 21:20:36 +0000 Message-ID: <20250224212051.1756517-6-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/dcache.c | 53 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index cd5e5139ca4c..1201149e1e2c 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1811,33 +1811,40 @@ struct dentry *d_alloc_name(struct dentry *parent, const char *name) } EXPORT_SYMBOL(d_alloc_name); +#define DCACHE_OP_FLAGS \ + (DCACHE_OP_HASH | DCACHE_OP_COMPARE | DCACHE_OP_REVALIDATE | \ + DCACHE_OP_WEAK_REVALIDATE | DCACHE_OP_DELETE | DCACHE_OP_REAL) + +static unsigned int d_op_flags(const struct dentry_operations *op) +{ + unsigned int flags = 0; + if (op) { + if (op->d_hash) + flags |= DCACHE_OP_HASH; + if (op->d_compare) + flags |= DCACHE_OP_COMPARE; + if (op->d_revalidate) + flags |= DCACHE_OP_REVALIDATE; + if (op->d_weak_revalidate) + flags |= DCACHE_OP_WEAK_REVALIDATE; + if (op->d_delete) + flags |= DCACHE_OP_DELETE; + if (op->d_prune) + flags |= DCACHE_OP_PRUNE; + if (op->d_real) + flags |= DCACHE_OP_REAL; + } + return flags; +} + void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) { + unsigned int flags = d_op_flags(op); WARN_ON_ONCE(dentry->d_op); - WARN_ON_ONCE(dentry->d_flags & (DCACHE_OP_HASH | - DCACHE_OP_COMPARE | - DCACHE_OP_REVALIDATE | - DCACHE_OP_WEAK_REVALIDATE | - DCACHE_OP_DELETE | - DCACHE_OP_REAL)); + WARN_ON_ONCE(dentry->d_flags & DCACHE_OP_FLAGS); dentry->d_op = op; - if (!op) - return; - if (op->d_hash) - dentry->d_flags |= DCACHE_OP_HASH; - if (op->d_compare) - dentry->d_flags |= DCACHE_OP_COMPARE; - if (op->d_revalidate) - dentry->d_flags |= DCACHE_OP_REVALIDATE; - if (op->d_weak_revalidate) - dentry->d_flags |= DCACHE_OP_WEAK_REVALIDATE; - if (op->d_delete) - dentry->d_flags |= DCACHE_OP_DELETE; - if (op->d_prune) - dentry->d_flags |= DCACHE_OP_PRUNE; - if (op->d_real) - dentry->d_flags |= DCACHE_OP_REAL; - + if (flags) + dentry->d_flags |= flags; } EXPORT_SYMBOL(d_set_d_op); From patchwork Mon Feb 24 21:20:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988959 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 BD1FE1D6DB9 for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; cv=none; b=I8qF5KowLP+IOX9AkW9/sJW4foFj/TzmPaNxcER81HYC5fgRq5jJKUw+fDMKqX23A9+lktOTbVHgRYAbqmu7+RhXvAsjI7w+/pegABshS0lKYibOfa+JW4pvUfbTJ2uJmpt0zRks8XtWFZfPT0tp86lKK6gI/4XUDmpQ6gKXVfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; c=relaxed/simple; bh=8p1bcouPMG3+Y1vuVzAjEaR/2q1CKaJWy45XAbOYFi0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pyOZ6L3mo5kD/Cu0Sfe4HSX1Tc5jZ9kRLKVVlg+yH8L/WsbpUHm0JJO86MEl+j0xTjKM68Kpus2PA3lJ1oo7EJJ97Mvt/5aJk3yADCw8Z1RcASRDe1KJlCDmQwLCixZxkGTRXPtxSeX20fCPA62/0J9ebvaPn9WDivgpI2+xnnY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=lfmavk88; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="lfmavk88" 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=V1AmfIcr1FuHheMfjRG7UFAAksNAqzZZSXJuXYqh/I8=; b=lfmavk88OPn3K9RntxsRIFeqzm KXEOf+hxoTOw1DcvpcqvkUYlRSkoeFXEibP2h3M/CBn7Hh/nFGskhhpzXyXuoI0482L2uijNZp91P ENWevpQHXeP/1ZMlfdJSLe1RZZDvQk07LVNfNaEU9NRHG7604fKww8R9bBv4QDFCoFPMO77ZW465O zxKXNmhbo3onNENgHU6+vv0nJSCNkfBO8EgZlswW63GdF3WH9NFGxnfxOAFvzPsJVsEUe4gez+5+0 FlJJEong2Ak0AQabY4J1Fntsd/FkaPFxrR361DCLo9ZyWSHsqfG8sIwfGdRvWZHMOHkwquvgIzOp0 jIpBqLpA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007MxF-1jAo; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 07/21] set_default_d_op(): calculate the matching value for ->d_flags Date: Mon, 24 Feb 2025 21:20:37 +0000 Message-ID: <20250224212051.1756517-7-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro ... and store it in ->s_d_flags, to be used in __d_alloc() Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/dcache.c | 6 ++++-- include/linux/fs.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 1201149e1e2c..a4795617c3db 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1705,14 +1705,14 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) dentry->d_inode = NULL; dentry->d_parent = dentry; dentry->d_sb = sb; - dentry->d_op = NULL; + dentry->d_op = sb->__s_d_op; + dentry->d_flags = sb->s_d_flags; dentry->d_fsdata = NULL; INIT_HLIST_BL_NODE(&dentry->d_hash); INIT_LIST_HEAD(&dentry->d_lru); INIT_HLIST_HEAD(&dentry->d_children); INIT_HLIST_NODE(&dentry->d_u.d_alias); INIT_HLIST_NODE(&dentry->d_sib); - d_set_d_op(dentry, dentry->d_sb->__s_d_op); if (dentry->d_op && dentry->d_op->d_init) { err = dentry->d_op->d_init(dentry); @@ -1850,7 +1850,9 @@ EXPORT_SYMBOL(d_set_d_op); void set_default_d_op(struct super_block *s, const struct dentry_operations *ops) { + unsigned int flags = d_op_flags(ops); s->__s_d_op = ops; + s->s_d_flags = (s->s_d_flags & ~DCACHE_OP_FLAGS) | flags; } EXPORT_SYMBOL(set_default_d_op); diff --git a/include/linux/fs.h b/include/linux/fs.h index 23fd8b0d4e81..473a9de5fc8f 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1392,6 +1392,7 @@ struct super_block { char s_sysfs_name[UUID_STRING_LEN + 1]; unsigned int s_max_links; + unsigned int s_d_flags; /* * The next field is for VFS *only*. No filesystems have any business From patchwork Mon Feb 24 21:20:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988967 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 BD40D1DB122 for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=e7Cukx50BS2ti9TxpQcF1aWssWoqy8BHPoD90SO/rI1QHAZVLKlToCvP1GN3FVOesVp4+kkdCG5z5+6Iml+zEhuhsOGtbxCOtZNCPMFB4UGQJ38XC5mA3CxiyExgqH94gjqNiT89hu/HLxkc5xqWBUrmXGLGdI85Oj7U2OhAk0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=9hluVPEYHHQLFtNGS/15wkkYwjw+IaVTArhwWU41vi8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ryBa44mUo17LkAUd1yrlUOuxcA2zMoKHCLkUcFKGvqSCEImxPkh7LG5H9xDRZIiaYwwGdeOHfYh8YE7CAfdfuZpevsx8vjbkU20b9GjxcRQWHxqaPUA+bZOISyxOJItSfP4hhZCwNo7UlxB+mSxf6XpjsVhupb3IeqKP/aXnNeU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=TOKQueYq; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="TOKQueYq" 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=mpgL5SpQCNaa9CtDJA+4p6r8A9vBvN1ZNlx9FA6k0Cc=; b=TOKQueYql72ccepxhFGmozlTU0 uYtlGxbfsdlloWMkqyBPqwIrlMOOW55Jm1ooun6u8Opjsv4sLuFMpKZnE8jeRKDp0A26B88SYP+dX iPaa9JF4HKR0tV2ot1q8EyxVHMK7NBrRgAhYHmC0EFYvfp23aHqkIW1faHCsxw5M7spT8Nzo2Sj6s XY6qmdCgF3AkwWQlcrcSwL5tB05nggsweBS7syb43SrB2NmVV8X3n1KmwxYA8O40AILDg5z1F4huE SQnRV9I/3bjHm0aQ4zwLcZp6Ba/coiqnngthrvM6cLZsD6LYr/vBaSpw+nabKfu53SqjgpKWWXds7 klErjWWg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007Mxb-1tHc; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 08/21] simple_lookup(): just set DCACHE_DONTCACHE Date: Mon, 24 Feb 2025 21:20:38 +0000 Message-ID: <20250224212051.1756517-8-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro No need to mess with ->d_op at all. Note that ->d_delete that always returns 1 is equivalent to having DCACHE_DONTCACHE in ->d_flags. Later the same thing will be placed into ->s_d_flags of the filesystems where we want that behaviour for all dentries; then the check in simple_lookup() will at least get unlikely() slapped on it. Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/libfs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index 929bef0fecbd..b15a2148714e 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -75,9 +75,11 @@ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, unsigned { if (dentry->d_name.len > NAME_MAX) return ERR_PTR(-ENAMETOOLONG); - if (!dentry->d_op) - d_set_d_op(dentry, &simple_dentry_operations); - + if (!(dentry->d_flags & DCACHE_DONTCACHE)) { + spin_lock(&dentry->d_lock); + dentry->d_flags |= DCACHE_DONTCACHE; + spin_unlock(&dentry->d_lock); + } if (IS_ENABLED(CONFIG_UNICODE) && IS_CASEFOLDED(dir)) return NULL; From patchwork Mon Feb 24 21:20:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988956 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 EA95F1DB15F for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; cv=none; b=dhOP9WfGa2eR5wxT1NvqtJ738uNM0REtOGEK9nFH3SBvUnozylHLes4RNRa6sJbI7K5cOmOZoiuP+OUr8VapKh1onwfqVlAXPlpX+4zuaaWGOKN0Jb4AeOu/0U0TtdHRH4eWsRqXfJ/+wc//6HVUf5OGR0nAGTwKSR+5ZSmysEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432056; c=relaxed/simple; bh=ne8AwtajFBNtxnmvMbN77JYghmiiYUG/qr6SBUgFxts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NSIXx7bPz8J2AwmqZeH8aILMDwUKZmYww0jMccQrWa4geOvRGmjVlAGynEL3FuUtjzu3z7Sv+BPaa4f+JKPRG9j5H2afSYugInWxuJK/t1048CjgLBIUWsXb9nq5mPxxwX2EiMvVCvPrhqbSIJIxwSIAQY7GIWDYZcx8EsQpe5g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=ky4UExG0; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="ky4UExG0" 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=ur2/0gQzExjG+dklyTjyj/DBtXM2nQPw/F4IiMN4Omc=; b=ky4UExG05flxkBi0khxfJZmqQR s/OJbMJ3gRBOUwFw95SihgRZEZETub700MyI9gW1dYdc4XCzRnwoQhFMVeLFqhRhFfrc3lzqOyjln VPtjop0iPWzfgM6my9BcSTh1mw4foFQAfzsL4uFUtjvlZrqw1lTbrm29+OjHeWExw2cOXuNFsAAdU 24zsYICdHb2HDVIqMpTkiKkquijXvhJ0tkS5+p9pSnpKjueTHFBVbXBwA8emAzJlEMWEsB+70ChNX e2faGct+uUwYXHJiujfPxvptqnfvtymEYKI8ScBcSd7I9I3fJbHHXlN77OsBKyoxB+r7u71KNy8e4 fTfoURaQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007Mxl-22Mw; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 09/21] make d_set_d_op() static Date: Mon, 24 Feb 2025 21:20:39 +0000 Message-ID: <20250224212051.1756517-9-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Convert the last user (d_alloc_pseudo()) and be done with that. Any out-of-tree filesystem using it should switch to d_splice_alias_ops() or, better yet, check whether it really needs to have ->d_op vary among its dentries. Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- Documentation/filesystems/porting.rst | 11 +++++++++++ fs/dcache.c | 5 ++--- include/linux/dcache.h | 1 - 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Documentation/filesystems/porting.rst b/Documentation/filesystems/porting.rst index 004cd69617a2..61b5771dde53 100644 --- a/Documentation/filesystems/porting.rst +++ b/Documentation/filesystems/porting.rst @@ -1164,3 +1164,14 @@ magic. If your filesystem sets the default dentry_operations, use set_default_d_op() rather than manually setting sb->s_d_op. + +--- + +**mandatory** + +d_set_d_op() is no longer exported (or public, for that matter); _if_ +your filesystem really needed that, make use of d_splice_alias_ops() +to have them set. Better yet, think hard whether you need different +->d_op for different dentries - if not, just use set_default_d_op() +at mount time and be done with that. Currently procfs is the only +thing that really needs ->d_op varying between dentries. diff --git a/fs/dcache.c b/fs/dcache.c index a4795617c3db..29db27228d97 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -1796,7 +1796,7 @@ struct dentry *d_alloc_pseudo(struct super_block *sb, const struct qstr *name) if (likely(dentry)) { dentry->d_flags |= DCACHE_NORCU; if (!dentry->d_op) - d_set_d_op(dentry, &anon_ops); + dentry->d_op = &anon_ops; } return dentry; } @@ -1837,7 +1837,7 @@ static unsigned int d_op_flags(const struct dentry_operations *op) return flags; } -void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) +static void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) { unsigned int flags = d_op_flags(op); WARN_ON_ONCE(dentry->d_op); @@ -1846,7 +1846,6 @@ void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op) if (flags) dentry->d_flags |= flags; } -EXPORT_SYMBOL(d_set_d_op); void set_default_d_op(struct super_block *s, const struct dentry_operations *ops) { diff --git a/include/linux/dcache.h b/include/linux/dcache.h index e8cf1d0fdd08..5a03e85f92a4 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -242,7 +242,6 @@ extern void d_instantiate_new(struct dentry *, struct inode *); extern void __d_drop(struct dentry *dentry); extern void d_drop(struct dentry *dentry); extern void d_delete(struct dentry *); -extern void d_set_d_op(struct dentry *dentry, const struct dentry_operations *op); /* allocate/de-allocate */ extern struct dentry * d_alloc(struct dentry *, const struct qstr *); From patchwork Mon Feb 24 21:20:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988971 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 EA9D61DB363 for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432058; cv=none; b=PtDDkZwIbcHyt1SAQS8O4p6RqHD7pqAaDcS0rnqTOwWNwGKU8i2ZDdF8OLy1x//tscrCN/l5Yh7qPZoRKctfIXrFyuqcdfzd2VJdEN/fmAp8ZyjJPcxN0H4lHxAW3Nt5nUgY9xa1tl+ggZvDwEwJrZFqyf4ZtupjBeKLyH1A/ts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432058; c=relaxed/simple; bh=SZUYx1406Eo8g30ExtRhWTaR5acc5X2bPDI9r3WI2QA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vb0uQzjcjDo1c6+lGJINlMm6SyY6BH5Fh4gugJAgkjM/koM6X5Ny+abHwPaRECgfLo7Qatcw7aWt60Yfszq7X6RCePK/2pXzahUrQTvBRk3z2rc5jGFZM8CtFlyp9jPvaJ2DItJcZyWU3cHHcTXVPmu9S3c/j2kdD7xLjn+tDek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=o9hHdbKm; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="o9hHdbKm" 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=svTQOMdKGP90ZyImR5PQr/o0jl5LgMpLxKeqaOVU22M=; b=o9hHdbKmPSJAaWHNkn/8XK9yn6 fHkN/jJa3kGXcoJOKt0PYtxqdFU9j1LG1E6MKbydUfcu8XvTdJ1V0+ThZgsXnOQkgkYIxZ6xlvU5M ICPHz5dyXoPssMEj49Ow7xzMWjUFQcBHKB0ay2Z8+Omkz8uDYxKe2qOQYcKtHJsCw5ZkrqZHFID3S RDzZ/VWPyZPqpAAXs+GqhTGJPYAJmJ2u2HZAwu2IfsaPI+4A/0Olc+DB673czmsAr7pxQmq5MTcRI SlPzA275OHXZklyc05NJf7CLB54ktCSEkniPKhQ5arPSyZNgJ+IfH7HSHwz53laZbYA35WjLwDGbX 53nsmRAw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007Mxr-2KYp; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 10/21] d_alloc_parallel(): set DCACHE_PAR_LOOKUP earlier Date: Mon, 24 Feb 2025 21:20:40 +0000 Message-ID: <20250224212051.1756517-10-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Do that before new dentry is visible anywhere. It does create a new possible state for dentries present in ->d_children/->d_sib - DCACHE_PAR_LOOKUP present, negative, unhashed, not in in-lookup hash chains, refcount positive. Those are going to be skipped by all tree-walkers (both d_walk() callbacks in fs/dcache.c and explicit loops over children/sibling lists elsewhere) and dput() is fine with those. NOTE: dropping the final reference to a "normal" in-lookup dentry (in in-lookup hash) is a bug - somebody must've forgotten to call d_lookup_done() on it and bad things will happen. With those it's OK; if/when we get around to making __dentry_kill() complain about such breakage, remember that predicate to check should *not* be just d_in_lookup(victim) but rather a combination of that with hlist_bl_unhashed(&victim->d_u.d_in_lookup_hash). Might be worth to consider later... Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/dcache.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index 29db27228d97..9ad7cbb5a6b0 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2518,13 +2518,19 @@ struct dentry *d_alloc_parallel(struct dentry *parent, unsigned int hash = name->hash; struct hlist_bl_head *b = in_lookup_hash(parent, hash); struct hlist_bl_node *node; - struct dentry *new = d_alloc(parent, name); + struct dentry *new = __d_alloc(parent->d_sb, name); struct dentry *dentry; unsigned seq, r_seq, d_seq; if (unlikely(!new)) return ERR_PTR(-ENOMEM); + new->d_flags |= DCACHE_PAR_LOOKUP; + spin_lock(&parent->d_lock); + new->d_parent = dget_dlock(parent); + hlist_add_head(&new->d_sib, &parent->d_children); + spin_unlock(&parent->d_lock); + retry: rcu_read_lock(); seq = smp_load_acquire(&parent->d_inode->i_dir_seq); @@ -2608,8 +2614,6 @@ struct dentry *d_alloc_parallel(struct dentry *parent, return dentry; } rcu_read_unlock(); - /* we can't take ->d_lock here; it's OK, though. */ - new->d_flags |= DCACHE_PAR_LOOKUP; new->d_wait = wq; hlist_bl_add_head(&new->d_u.d_in_lookup_hash, b); hlist_bl_unlock(b); From patchwork Mon Feb 24 21:20:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988962 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 1560C1DB375 for ; Mon, 24 Feb 2025 21:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=uKhJIUbTnsek/n0wz4c+qgveXL15FwBTowXpxIpv6QQF5lQmGuNwmZNUp7KmkEy9oZs+FaFE0J5nPaPCLbd8xP3K9dqmM/pLW4JDnvMxYmWVyAKrfHC6c6DEjCNHC7LqXNlFg9DTfxFWU8E4943i5M3ekLeW+iB4iRzUAnofiSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=d2659bhkIH35UsNdxRwr3J80C+cALvngos3Wn/bMAbQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AnimxkVOmx5h/14B5LuZf7F/FAye/J3zgQPFvlKsxTvTnJ0MjU4rp7k9sqkA3/wvLuFYvedlxs9a+rbVqLPwesh+Zv/Y1359mqwHKrrHmrZy/WLN2yC0MwIfZYnlwsYP69WFS7H7W3/BW5sulnMh9D/+Z/m9sRgDiHls/1+K0/Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=R9nlPdnQ; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="R9nlPdnQ" 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=ao6KHlhr+JzSMKp4DwoMsM8thCxjo1AWRSQjn4BSAhY=; b=R9nlPdnQWsXWIBLFQF9dd6kTdE F3DVVEdDXaoj7KVO+i+NqtiYvU0gc5SR2nHNsvCTFchTycNi4Q9DIkR8s1gLsAv5PdT9r3tN5ucvI D7didh2eClFLX1ARdgL14KPViGut75CNaEu46yttRnrS4RqUjJOfySY5UTTEsfqMGdxcuLqb2qpiV 4Nkk3w8kMDL5erj/CDA+XJmXETS7mVeGamPcb0prEDAUS4P4sYXOnF1K88inQptOGMtt9q7tmZkLX c8IFWR8iwVQMe+XIvzLl4QloSGqkBHDF9cy8dSnF8nR9CC052DiLz6L80OPa2qKtGDKywl+1R09DI 34SNjo0w==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007Mxx-2jDq; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 11/21] nsfs, pidfs: drop the pointless ->d_delete() Date: Mon, 24 Feb 2025 21:20:41 +0000 Message-ID: <20250224212051.1756517-11-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro No dentries are ever hashed on those, so ->d_delete() wouldn't be even looked at. If it's unhashed, we are not retaining it in dcache once the refcount hits zero, no matter what. Signed-off-by: Al Viro --- fs/nsfs.c | 1 - fs/pidfs.c | 1 - 2 files changed, 2 deletions(-) diff --git a/fs/nsfs.c b/fs/nsfs.c index 663f8656158d..f7fddf8ecf73 100644 --- a/fs/nsfs.c +++ b/fs/nsfs.c @@ -37,7 +37,6 @@ static char *ns_dname(struct dentry *dentry, char *buffer, int buflen) } const struct dentry_operations ns_dentry_operations = { - .d_delete = always_delete_dentry, .d_dname = ns_dname, .d_prune = stashed_dentry_prune, }; diff --git a/fs/pidfs.c b/fs/pidfs.c index 63f9699ebac3..c0478b3c55d9 100644 --- a/fs/pidfs.c +++ b/fs/pidfs.c @@ -521,7 +521,6 @@ static char *pidfs_dname(struct dentry *dentry, char *buffer, int buflen) } const struct dentry_operations pidfs_dentry_operations = { - .d_delete = always_delete_dentry, .d_dname = pidfs_dname, .d_prune = stashed_dentry_prune, }; From patchwork Mon Feb 24 21:20:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988968 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 841351DB924 for ; Mon, 24 Feb 2025 21:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=nsN8p9KsxPl3etB6581LL8eqTyJQHuaKQe+qkI8hxWejxP3u1axKqoNBN7uFxHNmlKIH3xVGfHca//ByJxMqn91tauINB2/8AZbkCsqqzc/vwacdDqujKPDzqGE8IyQU+JBWrRDFja9NXQpVfqgxvtspb6HvrSFRjh/N8Ywwhj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=NPPbaDJmaNqmL5MpPzHxHiJ1DJLXiZehhpRuPjGC8MM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k7YEGXX6eqL9Xf+24I+cSva8GNoStJ2IiKQcbvjcNl/zdDzwP/Xzql1q79MarBgDR08OiSVNkG0u6DvEAwMBu8AAD+rtXjogZqYfm9r6HmUVhOiv6Kfq92y5TXzyKYWN0xy9d2NEaCbdaqAub1yILlH4Qmv5Hop9dOHxUXJ9Vvs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=T9jQASEa; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="T9jQASEa" 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=WtKAUEuQhnljuFsyUMpPw1pmoCH3D2344CGwy3eQ60g=; b=T9jQASEafIuAd8qpXbX0UB7v9T tOjSLhzfvUIfjIR76MUK6qmkSMlLwAfQd1Ft4cHEEONPwgO1dHRsnIa4JY42mt+aJRBKPL1sXgsg2 hnqMbhI6LmXJT6ZErwYVveDE4aVS+QbCBnxu7dIDttx+YH9RquxYiIXWBoM/E3RW8GLh8krHYPfo3 W30MzKAprqZn1cgr8YIODllv5H36+nCFZZkkOLZagyaFrqH1vXxRmF4CTWC7pbl13TUV0MrKRM7Ut vSDKu3Q82QnCWIKdR2nHWMbvkpTW59SH0zjj1WIpgXn9qqBfhyU4wQPBpJxmvcRUzVvgBaCMKuAbZ djQQPKrw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007My4-37zT; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 12/21] shmem: no dentry retention past the refcount reaching zero Date: Mon, 24 Feb 2025 21:20:42 +0000 Message-ID: <20250224212051.1756517-12-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Just set DCACHE_DONTCACHE in ->s_d_flags and be done with that. Dentries there live for as long as they are pinned; once the refcount hits zero, that's it. The same, of course, goes for other tree-in-dcache filesystems - more in the next commits... Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 0ecb49113bb2..dd84b1c554a8 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -4971,7 +4971,6 @@ static void shmem_put_super(struct super_block *sb) static const struct dentry_operations shmem_ci_dentry_ops = { .d_hash = generic_ci_d_hash, .d_compare = generic_ci_d_compare, - .d_delete = always_delete_dentry, }; #endif @@ -5028,6 +5027,7 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc) #else sb->s_flags |= SB_NOUSER; #endif /* CONFIG_TMPFS */ + sb->s_d_flags |= DCACHE_DONTCACHE; sbinfo->max_blocks = ctx->blocks; sbinfo->max_inodes = ctx->inodes; sbinfo->free_ispace = sbinfo->max_inodes * BOGO_INODE_SIZE; From patchwork Mon Feb 24 21:20:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988965 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 60B541DB548 for ; Mon, 24 Feb 2025 21:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=W2kJAb43QJ58Jt6GY/QtCoDmAhJrOZrWrScK25kCD1u3X4x84X8gl1JN/uPiDoh6fBTAZgHIkHEIFqJ/8N8r573dmVMCeF371hEO6RDIO8pWUjbEW/6+7mfxjgrhMhAFlMO/JPYzSQQoS+1tcPvbvPTvuYel0xxRLyHCvifCrZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=pzVhNNSycZLwcra/LRDgOW/BFaSPn9URgkcC7mmcpuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mc+kHBEJkSw6FBRo/4G+YUdTqUpXrS+C7wrAd3gsA/EwMoogf07AkF+ZmwU+WiHxt+xZeJ6gTTiDCUnmhF+oTJKITUTevA5RZz4AwOiug1cUC4vrOxk7ASPz9Q7Tj7ufbzPgf4y8IPPqEpUoaKZFGXsLCTjDXR07UZTdIz2LRcQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=ucH1lMrL; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="ucH1lMrL" 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=8nWOoUPAozKOT6sknONZd+MJUdMcGxAsstbpKKQicvg=; b=ucH1lMrLd+frGgA9wYWgbMuCbM KaTZjnB7ee/6W93ylNBPt8KjCHlyji81ZVtJCm2Ei7RJk1e9t2dt1cPNuUpp5HNi84pTgC0ELYr5P +s2I7YRzS6maqhGDjPYsw5YvYtT0ecgUAnFaNWIdmXqImx5S6CG4QBX/rLzRoaBFEFSwcHFMS4qig LpBe6E46hyukPRGLKQC8EwN6muiZhaMTC0/65WwZjBWMJoIrTKgao4laL0mrD9iALSzZc4n1oxcYp uYCoxwR6f/TNnOMFMkLFbumF76nV/0sm3h1pAt7/h4ztvCZRD6+FuSv3+TlAhBiUpKdtPaSEAwwAN hYbn6NDQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007MyB-3mJp; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 13/21] devpts, sunrpc: don't bother with ->d_delete or ->d_op, for that matter Date: Mon, 24 Feb 2025 21:20:43 +0000 Message-ID: <20250224212051.1756517-13-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Just put DCACHE_DONTCACHE into ->s_d_flags. Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/devpts/inode.c | 2 +- net/sunrpc/rpc_pipe.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index f092973236ef..39344af02d1f 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -433,7 +433,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent) s->s_blocksize_bits = 10; s->s_magic = DEVPTS_SUPER_MAGIC; s->s_op = &devpts_sops; - set_default_d_op(s, &simple_dentry_operations); + s->s_d_flags = DCACHE_DONTCACHE; s->s_time_gran = 1; error = -ENOMEM; diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index e093e4cf20fa..acb28a502580 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c @@ -1363,7 +1363,7 @@ rpc_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize_bits = PAGE_SHIFT; sb->s_magic = RPCAUTH_GSSMAGIC; sb->s_op = &s_ops; - set_default_d_op(sb, &simple_dentry_operations); + sb->s_d_flags = DCACHE_DONTCACHE; sb->s_time_gran = 1; inode = rpc_get_inode(sb, S_IFDIR | 0555); From patchwork Mon Feb 24 21:20:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988963 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 C526A1DBB03 for ; Mon, 24 Feb 2025 21:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=RREvCAa+6n676hAMaD3aD1i03hWO3tuc38+W/qacwYPjclewF88rE64NevvYKExOszO0EmHnNwSEFaeutvGJqpUUAaV9R+Hm8F4gWvNbCBdPzY2alfJGL9tDCdXwY2J+paz2gDv3dmoBc7qf0EAozw/5AfpJ+P33SoYppTg78Q4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=83nk0FVDJeqrg7Q5kyyoA6JxH0aJCiga6QPnEGbcOlw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cqanY5rHaAqxbfgG+uHJu5sxMVXFxINXKbFhH4IEQaqBHIspDS4WiZUVmgVOn3QPhR2wdb4GsO/DJ8/9gU7eanYzrSYhBbcm7onmSHZrvTgua7DBYayg6bOTGxzOW9z/+XcZCDnfzwSrnhpyuSZ1309o2bM5E76cKsRz78Xr0gY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=jkyD3uAr; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="jkyD3uAr" 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=JK8SlADR+RwR4cMfo/XBrXrCpCIVHOdtaHNb4A2Eiv4=; b=jkyD3uArLDWx+36T/3pi69oJqx /kpjO2WGPKHHNCmT0UiY3FeMdrAhWNuodPHAk0EOgua8W5j8LxtFWEBOdVIvQC2Uoj93HOmKtwQ1+ XmKBk6DyLHguYBS+QTpXJR6lkBoXk5xXnm5k7JXlnOQ5f4p4FhNsIlbm+MxD+JKqY+5bpC4j0Vzeu FNMAcpuM+CjgX1myWVSIn//EWBMBN1rSgoSEI+h0dqcLBHN3d81iIrxC/+2dqpUTbbM71NPg/3PsW mt/EVOY3lHZO5REn3PqsjUTo94bZQ5KwraR/FSqwi5ntDE2CekLs5Lae+wR8yjaCQJwRnLmlHvvEt Jkh21w6w==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsi-00000007MyH-3wai; Mon, 24 Feb 2025 21:20:52 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 14/21] hostfs: don't bother with ->d_op Date: Mon, 24 Feb 2025 21:20:44 +0000 Message-ID: <20250224212051.1756517-14-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro All we have there is ->d_delete equal to always_delete_dentry() and we want that for all dentries on that things. Setting DCACHE_DONTCACHE in ->s_d_flags will do just that. Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/hostfs/hostfs_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index a0e0563a29d7..52479205cefe 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -920,7 +920,7 @@ static int hostfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize_bits = 10; sb->s_magic = HOSTFS_SUPER_MAGIC; sb->s_op = &hostfs_sbops; - set_default_d_op(sb, &simple_dentry_operations); + sb->s_d_flags = DCACHE_DONTCACHE; sb->s_maxbytes = MAX_LFS_FILESIZE; err = super_setup_bdi(sb); if (err) From patchwork Mon Feb 24 21:20:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988969 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 BB0181DB95E for ; Mon, 24 Feb 2025 21:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=LGxgtKJXbSQbSGYMn6XTnu2WXERaPMEft32DbO8Z1Wh315dnvNCkE+ZZFki5Ja04kAy/C+T7N+n7+y78SZVy45iPpK63PJMAxiAtdAlwAPRKrAe9LmBPZOSRyByP684xu3AvyfW5OybI8yCWpOBk7IKSFBbAmy7eIQ34LyJcx/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=2/QXtHLU9ehARia1kX8bsRUCiTiJ/mcEOpe5ZUu7OII=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=inu9jP6gNkqXyT2u1GlzCTIhoR9oOUS9uXiEfbhlGBqdMNKBTWmFtvEGQBUFJ4/Hb37ZlChx8V2DdKeqkEdL+l+2g6MHSJK65iXbXYTDofMkarQO2PJW0+/SdSt+p8cAUpVjrBCjgbh6uhf0A0UI8jN6hg3Qjqr6IGYaSjkP5i0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=IT2aBw0K; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="IT2aBw0K" 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=m50ym3+MGL2FOcGb7FkQYqb/iGBUcnFCwvaLBN6+K9g=; b=IT2aBw0KxSgaF06lyZ/WlafUS/ 149ogctKTyIYNNfCcoCSrsx2eCkWpny8OGgVHPonrrM5tW2LxGSL7W+svzW4q+wopRs7F62ENps3c /yt1UiBShUj40SCMbn0fI7p6NUPaVV2PFbrQR/g+WfJXGr7cTRri5BTVpgNOb/JPFxD8OPLhFuNT8 gWZou4+Ykqd2Y/Mq7QqDlGsKiRdsUQFLHr6wthj6ZlSuYuYzKDzz6tIzF2eZ2LWkrrkb+CPpupqQb DBm2fI1Y8avVYjKHN4fm8ElGVnRngJZrJdIiAouTNCp20Gp2J5RNQU2EBNEgxPfj6NTS8HDLFQ5/g rxNXkbog==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsj-00000007Myt-0x5V; Mon, 24 Feb 2025 21:20:53 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 15/21] kill simple_dentry_operations Date: Mon, 24 Feb 2025 21:20:45 +0000 Message-ID: <20250224212051.1756517-15-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro No users left and anything that wants it would be better off just setting DCACHE_DONTCACHE in their ->s_d_flags. Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/libfs.c | 5 ----- include/linux/fs.h | 1 - 2 files changed, 6 deletions(-) diff --git a/fs/libfs.c b/fs/libfs.c index b15a2148714e..7eebaee9d082 100644 --- a/fs/libfs.c +++ b/fs/libfs.c @@ -62,11 +62,6 @@ int always_delete_dentry(const struct dentry *dentry) } EXPORT_SYMBOL(always_delete_dentry); -const struct dentry_operations simple_dentry_operations = { - .d_delete = always_delete_dentry, -}; -EXPORT_SYMBOL(simple_dentry_operations); - /* * Lookup the data. This is trivial - if the dentry didn't already * exist, we know it is negative. Set d_op to delete negative dentries. diff --git a/include/linux/fs.h b/include/linux/fs.h index 473a9de5fc8f..bdaf2f85e1ad 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3540,7 +3540,6 @@ extern const struct address_space_operations ram_aops; extern int always_delete_dentry(const struct dentry *); extern struct inode *alloc_anon_inode(struct super_block *); extern int simple_nosetlease(struct file *, int, struct file_lease **, void **); -extern const struct dentry_operations simple_dentry_operations; extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags); extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *); From patchwork Mon Feb 24 21:20:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988964 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 D89D31DB365 for ; Mon, 24 Feb 2025 21:20:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=u3m+n5hHMS3mQQ3g+np/83Ahi8Od9RzxcvfoGuPOv+OixoOFuF+100R3TN/B6h99fOHTgUkbQOGht8z80lAxzGEYjSbcm53Z03bNtIXRhktDSUtPQlCdLYkBGCmxImIjvwLSEzE0HlxwTLqibQgqrXFUPeZdVpFtknlr5g5ObmE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=hSOG7xe+/GVqAfdCPIjEuY0FzmW4woWIO62hXEvnXjY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oi4nMphBS11v3n8BGXTIUjphzjwN765Eo3L8QUZ3fIyEB6nGn/AQ8go0iRYAtBnRQKCkEFAQLkObTQDOTZ6vCJ1AYf4IFD+OyTOxCi2qCQjzXgtCZzm2IHuBlotAnezbcRjSrjdYFiiPtUehG+xMoiIXFXBZ5C/UogNs5alXo0k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=Gd8vKzW8; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="Gd8vKzW8" 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=kQxbqwabztLHj1KjTc0ureYK+atGoV7lXfY1w60QLO4=; b=Gd8vKzW80GoEfHiovQCaC7ea24 WCVTOW01dBif2tYqrOtF0ebMZjMVa74qXk5N3/H/suxm9tFXgNh055PNDwL4XEJh/9E++GYrYEyD5 JdBjjkOcSLOXTASkV69gOeyYqSdD5L8hr8baqU+YeVmpLhTUKXUxbMOTPsqJD9Gw6YJ9j3rUVlY3o fHkcBtdbgCww5wg1hLo8DKiREFSsMsW+cAXtPlXKLdJOb+wiPsuSu+q0G39lqGp1yGG3VWMGG02NB RzJdJVlGy5jBvvXf03FU65F9yuX25vJU+igvKN8YflEId+b0KGsmkI2EwoH9HHUu10vfVLNBaJD0J Fuy/gK6w==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsj-00000007Mz2-1dtd; Mon, 24 Feb 2025 21:20:53 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 16/21] ramfs, hugetlbfs, mqueue: set DCACHE_DONTCACHE Date: Mon, 24 Feb 2025 21:20:46 +0000 Message-ID: <20250224212051.1756517-16-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro makes simple_lookup() slightly cheaper there. Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/hugetlbfs/inode.c | 1 + fs/ramfs/inode.c | 1 + ipc/mqueue.c | 1 + 3 files changed, 3 insertions(+) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 0fc179a59830..205dd7562be1 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1431,6 +1431,7 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize_bits = huge_page_shift(ctx->hstate); sb->s_magic = HUGETLBFS_MAGIC; sb->s_op = &hugetlbfs_ops; + sb->s_d_flags = DCACHE_DONTCACHE; sb->s_time_gran = 1; /* diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c index 8006faaaf0ec..c4ee67870c4b 100644 --- a/fs/ramfs/inode.c +++ b/fs/ramfs/inode.c @@ -269,6 +269,7 @@ static int ramfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize_bits = PAGE_SHIFT; sb->s_magic = RAMFS_MAGIC; sb->s_op = &ramfs_ops; + sb->s_d_flags = DCACHE_DONTCACHE; sb->s_time_gran = 1; inode = ramfs_get_inode(sb, NULL, S_IFDIR | fsi->mount_opts.mode, 0); diff --git a/ipc/mqueue.c b/ipc/mqueue.c index 35b4f8659904..dbd5c74eecb2 100644 --- a/ipc/mqueue.c +++ b/ipc/mqueue.c @@ -411,6 +411,7 @@ static int mqueue_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_blocksize_bits = PAGE_SHIFT; sb->s_magic = MQUEUE_MAGIC; sb->s_op = &mqueue_super_ops; + sb->s_d_flags = DCACHE_DONTCACHE; inode = mqueue_get_inode(sb, ns, S_IFDIR | S_ISVTX | S_IRWXUGO, NULL); if (IS_ERR(inode)) From patchwork Mon Feb 24 21:20:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988970 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 6AEA11DC997 for ; Mon, 24 Feb 2025 21:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432058; cv=none; b=aSTy3py86RlTXyl/haY+kPkgvLUBys+Zed3KfgXWrFO8J9uoJASV+1wcg0PEjlBOaSA3xxyjTm27MUEEiwJYGGfzpH7bKWNTfI5wC7c2imXeBWYFaZID+4zg174S+wXC4dI9rvRjxofI2xayo0nkCaEED1hOOxCCGPM/RaGqZCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432058; c=relaxed/simple; bh=LBHzn7RwOklAdFp3WzStKaRTJOCVYgwhY4tORFpR+A4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XPGEDDK6JqmV+AC7KPoExpd5k4AA6wo/AI5ASK18/LVw6uWrj+A0c8pbYX8XvGUGdBMFgSLbvDOoEbKBYKeViV3bW4XUBQFXjHhy0poM95HSYTnUsa5ZSFp3KecvzNKElQOgAxou6Erkb6I2prR1YGxmfwrwv1jZ0Xm8KW1CIAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=sRvDgVtv; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="sRvDgVtv" 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=oOQGNCemIs5zXD0VP/IqJ2UgtHWT3XXigibo/hkPmbw=; b=sRvDgVtvqOAz+GF13vTKP7jH84 PdGRxcmQrgPHnOanfCOEoOdC2feSB38YLz2F+iNZQZKMTVYeV2Cr2HVN4KEYf9xiEnib3bAC8KR69 DdnfwlsoMFO1H9GC847j6ysCwKPmBIEcsPRVM7cBXyt9OJsXyqsKoHJ5H4h0i8drmx/jZcEcLENiL RxFw5OYALGbaFbWbroF4dE3FPeQLyHhT/6GFa5EnuIZSC/PdIB7qzn0i0VGtOctdqKNk9lUevwO41 RBwIPNGqZD9i5k9RmsDPJG5F5jPZCRq1vQiXAmjVKvdTkFXiD1UVyWehOtOQuLZ71UxvAV6v1YDi/ ziqAPSWg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsj-00000007MzG-2CyE; Mon, 24 Feb 2025 21:20:53 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 17/21] 9p: don't bother with always_delete_dentry Date: Mon, 24 Feb 2025 21:20:47 +0000 Message-ID: <20250224212051.1756517-17-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro just set DCACHE_DONTCACHE for "don't cache" mounts... Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/9p/vfs_dentry.c | 1 - fs/9p/vfs_super.c | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index 5061f192eafd..04795508a795 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c @@ -127,7 +127,6 @@ const struct dentry_operations v9fs_cached_dentry_operations = { }; const struct dentry_operations v9fs_dentry_operations = { - .d_delete = always_delete_dentry, .d_release = v9fs_dentry_release, .d_unalias_trylock = v9fs_dentry_unalias_trylock, .d_unalias_unlock = v9fs_dentry_unalias_unlock, diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 5c3dc3efb909..795c6388744c 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -134,10 +134,12 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags, if (retval) goto release_sb; - if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) + if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { set_default_d_op(sb, &v9fs_cached_dentry_operations); - else + } else { set_default_d_op(sb, &v9fs_dentry_operations); + sb->s_d_flags |= DCACHE_DONTCACHE; + } inode = v9fs_get_new_inode_from_fid(v9ses, fid, sb); if (IS_ERR(inode)) { From patchwork Mon Feb 24 21:20:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988966 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 4B7631DB55C for ; Mon, 24 Feb 2025 21:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; cv=none; b=k1yU8Ng2EPIbmUvYltmbGQo2tfkX68m39sRdynlc8BP08sBnZGsqyFAMcvFFextQeRv6VUJmB6ygzpAZEaWjgsDLhM5Dne9E+ER9Z3T1uF3TujwUsO7cJIvW8aRtgnh3F5VUfGmll5Rfc6Yafd+eQmPQc9goN+EcnFCFqrwuIDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432057; c=relaxed/simple; bh=HjgQDYRcXWQn7G+tjSlMmJiwKgtYF4fzVHAYzLinFwI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AtjDI2qfP8r527lMu9hP5at8kbdg4IYK55TFqBHqPbY8OS/BNZMqALJ0VecY74wTWqNg/SldF4sI9IaTe302KCbJDB4KecQ6D2XOjwvh/uf8f9+n2wrVCQzLEPxiGqLrZdxGxnFhIuWYpPt2Lde1DXLX7/Y51pfMPkIdmnGaJ2I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=Ew4CKyGb; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="Ew4CKyGb" 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=oYFi1A8M0zzxnLPLxxvpyZpqrE002jgcmYOtbb39RAg=; b=Ew4CKyGbIfAQ2jbmjiW/TTrLK6 pAZA8bpGRMsI2VgU7+PmpIoIkc41WWBEpv+OMJzJtzGPyj+YyfJnqKX/1ifQuA6uHfEWtXa44sKw0 pVhIuBtK1JjqiRi2v+ujylfHYbwnOqEXtSKJGOAV12SPM20XsL3BeV7Mc0ZFb61XJzwHQ22/jKzb7 +3MaBYvk+4FV4P9vTvREb9nmIa04Z6Fu7jjXSV6RiIKncJgNCCEf5CO07fMk2XLDlsUh1vnBWU3Iz 3/mEr8uyQI7bo15M8757fX0Q8l1x6dj4trC1fqvR4iPrPO4bpBIh38ZN1dYErFDHwaRo6Qiww89nS yMOVUgAA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsj-00000007MzM-2xh1; Mon, 24 Feb 2025 21:20:53 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 18/21] efivarfs: use DCACHE_DONTCACHE instead of always_delete_dentry() Date: Mon, 24 Feb 2025 21:20:48 +0000 Message-ID: <20250224212051.1756517-18-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/efivarfs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 3f3188e0cfa7..e5d3147cfcea 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c @@ -175,7 +175,6 @@ static int efivarfs_d_hash(const struct dentry *dentry, struct qstr *qstr) static const struct dentry_operations efivarfs_d_ops = { .d_compare = efivarfs_d_compare, .d_hash = efivarfs_d_hash, - .d_delete = always_delete_dentry, }; static struct dentry *efivarfs_alloc_dentry(struct dentry *parent, char *name) @@ -346,6 +345,7 @@ static int efivarfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_magic = EFIVARFS_MAGIC; sb->s_op = &efivarfs_ops; set_default_d_op(sb, &efivarfs_d_ops); + sb->s_d_flags |= DCACHE_DONTCACHE; sb->s_time_gran = 1; if (!efivar_supports_writes()) From patchwork Mon Feb 24 21:20:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988972 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 690491DC98B for ; Mon, 24 Feb 2025 21:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432058; cv=none; b=KPELuVxgIRQ5l1WZEcj4N56qlglZ5MnqrSxszhvlBb3IymNduQs3/sjhOOn5hyQLSrxcqOLyc6ASy7EbXkI0NLhPZgU6Aj4Oe+9BUiQwgYRsCERJnvTfMfxisGf4rP4I5HxlIhfjIO/0Hl3eh2q9dmri8LQeWHUJeDgYgmfF+XE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432058; c=relaxed/simple; bh=BtW1UeSGvcKEZ/y22XbKV5Df9aRyoT7OXggm6A+Qs6Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MfQi4rIDTkXN/pkf4dvMyf3KUXgVZyX7V5Iht8yGWuClKPpJ8tK5dmrC0Wh/D5Ut+km3kreOoAZ8bV7Ay024f+hGIWdxR5+N3610XmeCBlPPd+JmhwRZIDorL2LHQjzrY95t5IhWCJzlGIWDFxnQpA8hYBnI9mqDtUu7OJd8roc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=WriGyRZM; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="WriGyRZM" 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=YFBTK8tDVuQLP/MDhvTlHFHCw9tfu5tbkzLc9m6Gpmc=; b=WriGyRZM0OBBdmzYAX/lDqCVZf H103gFJwNJQVSGtSERGv18QWE5jzI8ZdWE7V4jtLeGrCU4GSxP1N/1qjR5ym/eG0Kq50QVk5INMPJ 3kd2CL8TjB6fegeXrOHR2/2J+2ESKxrHD015oNP55ZXuLPhQNabF/bYOIJI32ykHKKTg49OnxOYy7 E4DD5QwGHhsFSi4Ilgv6zPzlScaPTpzUZMhV4vwL96h6ciJAgmK/BDH+HI7MDhtpINm9SbOg5vsmB gYHI0TJkYF5lPMRAybzsZ4FZunTSjwo/ceWMtSXkbUCirSosfSYE30HWsdCjnE3nne4POLjkz4NjL eLPMYXyQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsj-00000007MzU-3Da1; Mon, 24 Feb 2025 21:20:53 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 19/21] debugfs: use DCACHE_DONTCACHE Date: Mon, 24 Feb 2025 21:20:49 +0000 Message-ID: <20250224212051.1756517-19-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/debugfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index f54a8fd960e4..1c71d9932a67 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c @@ -258,7 +258,6 @@ static struct vfsmount *debugfs_automount(struct path *path) } static const struct dentry_operations debugfs_dops = { - .d_delete = always_delete_dentry, .d_release = debugfs_release_dentry, .d_automount = debugfs_automount, }; @@ -274,6 +273,7 @@ static int debugfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_op = &debugfs_super_operations; set_default_d_op(sb, &debugfs_dops); + sb->s_d_flags |= DCACHE_DONTCACHE; debugfs_apply_options(sb); From patchwork Mon Feb 24 21:20:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988973 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 675BE1DC988 for ; Mon, 24 Feb 2025 21:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432058; cv=none; b=aAR26+8Gqk5Muh36aQf0d1mEHZo9Q3XLR6xeQbRPKzf7z6KGOo2865sAeQtbMiU+FMxFCHbpvVnLFqvjOoiMTUZL47ynJKeFmwfLcnMdXKmypjdMhrNTvGxzsbcRQWCeZfKxz8rk/aXkIw/gbvWBqlxY6LVqG5KrhL0BAlC1DN8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432058; c=relaxed/simple; bh=/A09aAjRjuwKtcQrKKqLGcjpx0yAwegBq/fe06evzgw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jLXqu/vjig8BGYkGttpfuwe1m4uphk185MKBlVcD6jNziQj/KIYeMldX8/2zLU08ICvlgWXO8hYcgqC4y/qHu0Ag0fAeCkrgucTsKXla/9XIJT95ZpFPHDL1frFRPviakgCjjXEEqCQW9jYMYCT83IrdfOezX4Y4Mt8vrvvf9As= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=IacL6qOi; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="IacL6qOi" 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=VYZO+x/hvyf21V34X4v4xsQI3+aYJvPgNcWQXmiLaQ8=; b=IacL6qOixcKSg7mp5K9h57hkUN bOi4/3d9WBqUVa+j7QJBqtr96HvGyKP60Q/YVbKF1B0rGeP6Vd101cngtbCDpmH0/IiALbg8ceUnT wnk+V48ce1Mx0Ki0y0lJ38LzLeTYB0uN7RJ5xb4EzS34xAlrdvlTB8OSpBmU21FhmUgClHfiCI9/r qWZ2mdVyRYAT3sJc5yG/oexhFAyW9ORP4Bn6wHFKYBfENgUF+/jJQTRxxg5GINgd/jBZfsayZ8INe Kifz+5pHGhGQSpMzVoVvbP7HpJZOpdOe3/qeRl1KLKwVIhlHfi0v1n2uuK065ix7sgGBkekDsfs3K UWM8hrmQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsj-00000007Mzb-3aSR; Mon, 24 Feb 2025 21:20:53 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 20/21] configfs: use DCACHE_DONTCACHE Date: Mon, 24 Feb 2025 21:20:50 +0000 Message-ID: <20250224212051.1756517-20-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/configfs/dir.c | 1 - fs/configfs/mount.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 7d10278db30d..637267a76ad8 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -67,7 +67,6 @@ static void configfs_d_iput(struct dentry * dentry, const struct dentry_operations configfs_dentry_ops = { .d_iput = configfs_d_iput, - .d_delete = always_delete_dentry, }; #ifdef CONFIG_LOCKDEP diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index 20412eaca972..740f18b60c9d 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c @@ -93,6 +93,7 @@ static int configfs_fill_super(struct super_block *sb, struct fs_context *fc) root->d_fsdata = &configfs_root; sb->s_root = root; set_default_d_op(sb, &configfs_dentry_ops); /* the rest get that */ + sb->s_d_flags |= DCACHE_DONTCACHE; return 0; } From patchwork Mon Feb 24 21:20:51 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 13988974 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (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 824F31DC99C for ; Mon, 24 Feb 2025 21:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.89.141.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432059; cv=none; b=uWDmwYJea/J58JcCQMJ/quIo3qFge7mQpWtdI3T4KwAF8ZA5hjTXJ1MsbKwqez0sMTLZySQbBIVWB2GSBGG1CdeEvq027SYq2BG8jQcTziMqzYqoMpbj2e6ofLnsycOgdAIC1UVa8E/fCZ5OrHWDpdDxSJT/5JOZ2YBbMCISNOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740432059; c=relaxed/simple; bh=MXpyfipa9ZOWs0nG+khW69rGRkx3F6l7QUpOX9mEDS4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RueYfCU6QejbengWOjZvII35KdjEDvLLEeyxJJu/PnUniaGqs3S626lzRjAfhOA7GNpZxJXJbmbJxhpM6zxTaj6G/eWz1BK/K71mQHSLsfr0jBZzzbPrOQcMrhhiqlXH4Cjvj+sZG132YU/oSl7fcQDs9ruIjXojDcImM5mz050= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk; spf=none smtp.mailfrom=ftp.linux.org.uk; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b=HyhaoUfR; arc=none smtp.client-ip=62.89.141.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="HyhaoUfR" 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=+1rnL5aSvb2B+IFEwMZXLhjXwKraJlB9LoT01doRm0Q=; b=HyhaoUfRQZOrnZqr8IuxJa/wSI 3vbgsc6nC8c/obwgRjczLrvpmUnzSnbYd5Lfg9RxJZp7ywJ28obuFzeQV/yDeHkNUVLONcySvjkq6 8uzeWJkcXY3rAKPbfaOOraCoNYCncwCh2JvhFpvyAvGbN6CCA4EB6Ss0T58+gRF8KWXUheDnVzZK+ nJjIRaBwuN3RBC3ceCU25eJEseunPB10KZcqNfUS7K+npvBp/3SmL063l5z0buJzbbCALQT3MO38e LEfgUMtTQ/8Uy4fTY8nUYBvjsrlhCjwG5f+zdeoSsGeynUR8LcwCYB1W22YzkUj3plzvTlMC37cix 2h/gZHDA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.98 #2 (Red Hat Linux)) id 1tmfsj-00000007Mzn-49vB; Mon, 24 Feb 2025 21:20:54 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , Neil Brown , Miklos Szeredi , Jan Kara Subject: [PATCH 21/21] afs dynroot: use DCACHE_DONTCACHE Date: Mon, 24 Feb 2025 21:20:51 +0000 Message-ID: <20250224212051.1756517-21-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250224212051.1756517-1-viro@zeniv.linux.org.uk> References: <20250224141444.GX1977892@ZenIV> <20250224212051.1756517-1-viro@zeniv.linux.org.uk> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sender: Al Viro Signed-off-by: Al Viro Reviewed-by: Christian Brauner --- fs/afs/dynroot.c | 1 - fs/afs/super.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c index d8bf52f77d93..2fad2987a6dc 100644 --- a/fs/afs/dynroot.c +++ b/fs/afs/dynroot.c @@ -211,7 +211,6 @@ const struct inode_operations afs_dynroot_inode_operations = { }; const struct dentry_operations afs_dynroot_dentry_operations = { - .d_delete = always_delete_dentry, .d_release = afs_d_release, .d_automount = afs_d_automount, }; diff --git a/fs/afs/super.c b/fs/afs/super.c index 13d0414a1ddb..b48f524c1cb6 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c @@ -488,6 +488,7 @@ static int afs_fill_super(struct super_block *sb, struct afs_fs_context *ctx) if (as->dyn_root) { set_default_d_op(sb, &afs_dynroot_dentry_operations); + sb->s_d_flags |= DCACHE_DONTCACHE; ret = afs_dynroot_populate(sb); if (ret < 0) goto error;