__lookup_mnt(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

Okay so bestie, this is __lookup_mnt from the Kernel API Manual β€” it's literally a mount hash lookup and it's giving main-character energy πŸ‘‘.

πŸŽ€ SYNOPSIS πŸŽ€

struct mount * __lookup_mnt (struct vfsmount *mnt , struct dentry *dentry );

🌸 ARGUMENTS 🌸

  • mnt β€” the parent mount, aka the one we're checking on 🫢
  • dentry β€” dentry of the mountpoint, aka where the mount is posted up πŸ“

πŸ’– DESCRIPTION πŸ’–

So if mnt has a child mount c mounted on dentry, you find it and return it. That's the whole vibe. ✨

But if mnt is unmounted and a child that was unmounted with it left its cover behind at dentry, return the stand-in for it instead: knullfs for a directory, its regular file for anything else. Not me learning about leftover covers πŸ˜­πŸ’€

⚠️ Locking check, bestie β€” this is non-negotiable: the caller must either hold the spinlock component of mount_lock or hold rcu_read_lock, sample the seqcount component before the call and recheck it afterwards. No cap, do not skip this πŸ”’πŸ”₯

πŸ¦‹ RETURN πŸ¦‹

The child of mnt mounted on dentry, a stand-in or NULL. Periodt πŸ’…

🌈 SEE ALSO 🌈

Kernel file ./fs/namespace.c plus the whole friend group: mnt_get_write_access(9), mnt_want_write(9), mnt_get_write_access_file(9), mnt_want_write_file(9), mnt_put_write_access(9), mnt_drop_write(9), mnt_hold_writers(9), mnt_unhold_writers(9), lookup_mnt(9), attach_mnt(9), vfs_create_mount(9), path_is_mountpoint(9), may_umount_tree(9), may_umount(9), clone_private_mount(9), attach_recursive_mnt(9), do_lock_mount(9), path_overmounted(9), can_move_mount_beneath(9), mnt_set_expiry(9), mnt_allow_writers(9). Go read them, they ate πŸ“πŸ’œ


Made with πŸ’– in ./fs, October 2026 edition. Stay mounted, bestie 🧚🫢

πŸ“¦ where this page comes from