super_lock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… super_lock(9) β€” the kernel API manual, bestie edition ✨

okay so like, this is a page from the Kernel API Manual, and it's about super_lock, which is genuinely one of those functions that's lowkey holding the whole vibe together. buckle up πŸŽ€


🌸 NAME 🌸

super_lock β€” wait for a superblock to become ready, then lock it. that's it, that's the whole job, and it does it slayfully πŸ’–


✨ SYNOPSIS ✨

bool super_lock (struct super_block *sb , bool excl );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • sb β€” the superblock you're waiting on. like, the main character of this whole situation πŸ‘‘
  • excl β€” a bool that answers the question "do we need exclusive access, yes or no?" 🫢

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea β˜•. if the superblock hasn't been through vfs_get_tree or generic_shutdown_super yet, we just wait for that to happen. no cap, we sit there.

and then literally one of two things goes down:

  • the superblock creation succeeds, and SB_BORN gets set by vfs_get_tree πŸŽ‰
  • or we get woken up and we see SB_DYING πŸ’€

either way you're not guessing, the flags tell you everything. iykyk.

⚠️ okay important: the caller must have acquired a temporary reference on sb->s_passive. not optional, not a suggestion, it's giving mandatory. fr fr do not skip this πŸ™ˆ

πŸ”₯ RETURN πŸ”₯

  • returns true if SB_BORN was set β€” and it comes back with s_umount held πŸ”’βœ¨
  • returns false if SB_DYING was set β€” and it comes back without s_umount held 🫠

so like, the return value and the lock state are a package deal. know which one you got before you do anything else, bestie πŸ’…


🌈 SEE ALSO 🌈

this is the friend group, and honestly? iconic lineup πŸ”₯ all of these live in the kernel file ./fs/super.c:


and that's the whole page, bestie 🫢 mwah πŸ’‹

πŸŽ€ cute lil sign-off: this one comes to you from ./fs, dated October 2026, and it's super_lock(9) all the way down. periodt. 🌟
πŸ“¦ where this page comes from