summaryrefslogtreecommitdiff
path: root/fs/mount.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2025-08-20 03:23:12 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2025-09-15 21:26:05 -0400
commit25423edc787842d17520b3f9df4d0a58a6a663b1 (patch)
treeedcb63f6345d6a5373d02bc889be1dc3c350bec1 /fs/mount.h
parented8ba4aad78887d88231c1c66c0ddf9fe12aaad1 (diff)
new helper: topmost_overmount()
Returns the final (topmost) mount in the chain of overmounts starting at given mount. Same locking rules as for any mount tree traversal - either the spinlock side of mount_lock, or rcu + sample the seqcount side of mount_lock before the call and recheck afterwards. Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/mount.h')
-rw-r--r--fs/mount.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/mount.h b/fs/mount.h
index ed8c83ba836a..04d0eadc4c10 100644
--- a/fs/mount.h
+++ b/fs/mount.h
@@ -235,4 +235,11 @@ static inline void mnt_notify_add(struct mount *m)
}
#endif
+static inline struct mount *topmost_overmount(struct mount *m)
+{
+ while (m->overmount)
+ m = m->overmount;
+ return m;
+}
+
struct mnt_namespace *mnt_ns_from_dentry(struct dentry *dentry);