can_move_mount_beneath(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… can_move_mount_beneath(9) β€” like, the Kernel API Manual page, bestie

okay so this is a page straight out of the Kernel API Manual and it's literally about checking whether we can mount beneath the top mount. yes, beneath. under. the vibes are immaculate and the locking is intense 🫢


✨ SYNOPSIS ✨

int can_move_mount_beneath (const struct mount *mnt_from , const struct
       mount *mnt_to , struct pinned_mountpoint *mp );

πŸŽ€ ARGUMENTS πŸŽ€

  • mnt_from β€” the mount we're trying to move. main character of the operation πŸ’«
  • mnt_to β€” the mount we want to mount under. yes bestie, under.
  • mp β€” the mountpoint of mnt_to. it's giving "where exactly are we doing this".

🌸 DESCRIPTION 🌸

so like, this function runs a whole vibe check on the situation before anything gets moved. three checks, no cap:

  • Make sure that mnt_from can take over the lock of mnt_to. and heads up β€” a mount of a mount namespace file is left out of a copy of the tree, so it literally can't. sorry to that mount πŸ™ˆ
  • Ensure that nothing has been mounted on top of mnt_from before we grabbed namespace_sem β€” because otherwise we'd be creating pointless shadow mounts and honestly? nobody has time for that.
  • Prevent mounting beneath a mount if the propagation relationship between the source mount, parent mount, and top mount would lead to nonsensical mount trees. like, we are NOT letting the tree become a mess. periodt πŸ”₯

πŸ”’ CONTEXT πŸ”’

this function expects namespace_lock to be held. so hold it. fr fr.


⭐ RETURN ⭐

  • on success: 0 ✨
  • on error: a negative error code 😭

πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./fs/namespace.c, plus the whole friend group:


bestie reminder: namespace_lock held or this whole thing is a no πŸ’€

and that's the page!! sign-off szn: this one lives in ./fs, dated October 2026, and it's page can_move_mount_beneath(9) of the Kernel API Manual. go mount responsibly, ily πŸ’–πŸŒˆπŸŽ€

πŸ“¦ where this page comes from