[Devel] [PATCH vz9 3/6] proc: add proc_splice_unmountable()
Vasileios Almpanis
vasileios.almpanis at virtuozzo.com
Thu Jan 8 12:17:16 MSK 2026
From: Christian Brauner <brauner at kernel.org>
Add a tiny procfs helper to splice a dentry that cannot be mounted upon.
Link: https://lore.kernel.org/r/20240806-work-procfs-v1-3-fb04e1d09f0c@kernel.org
Reviewed-by: Josef Bacik <josef at toxicpanda.com>
Signed-off-by: Christian Brauner <brauner at kernel.org>
(cherry picked from commit 15a695848bc989c431a0f3ff9bfd03b6126134c5)
https://virtuozzo.atlassian.net/browse/VSTOR-121919
Signed-off-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
---
fs/proc/internal.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 06a80f78433d..dd0408f0278b 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -313,3 +313,16 @@ 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;
}
+
+/*
+ * Add a new procfs dentry that can't serve as a mountpoint. That should
+ * encompass anything that is ephemeral and can just disappear while the
+ * process is still around.
+ */
+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);
+}
--
2.43.0
More information about the Devel
mailing list