super_lock(9)
π 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_BORNgets set byvfs_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
trueifSB_BORNwas set β and it comes back withs_umountheld πβ¨ - returns
falseifSB_DYINGwas set β and it comes back withouts_umountheld π«
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:
alloc_super(9)deactivate_locked_super(9)deactivate_super(9)grab_super(9)retire_super(9)generic_shutdown_super(9)sget_fc(9)iterate_supers_type(9)reconfigure_super(9)emergency_thaw_all(9)get_anon_bdev(9)sget_dev(9)fs_bdev_freeze(9)fs_bdev_thaw(9)fs_bdev_file_open_by_dev(9)fs_bdev_file_open_by_path(9)fs_bdev_unregister(9)fs_bdev_file_release(9)get_tree_bdev_flags(9)get_tree_bdev(9)vfs_get_tree(9)sb_wait_write(9)freeze_super(9)thaw_super(9)
and that's the whole page, bestie π«Ά mwah π
π cute lil sign-off: this one comes to you from./fs, datedOctober 2026, and it'ssuper_lock(9)all the way down. periodt. π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms