fs_bdev_unregister(9)
π¦ fs_bdev_unregister β ok so this is the breakup function, bestie
no cap, it literally just drops a superblock's claim on a block device. that's the whole vibe.
β¨ SYNOPSIS β¨
void fs_bdev_unregister (struct file *bdev_file , struct super_block *sb );
like, void, so it gives you nothing back. it just takes. iconic behavior honestly π
π ARGUMENTS π
bdev_fileβ the file you got back fromfs_bdev_file_open_by_{dev,path}(). yes that one. don't just hand over a random file, we're not animals π«Άsbβ the superblock that this device was claimed for. the whole reason we're here.
πΈ DESCRIPTION πΈ
okay so picture this: it's the literal inverse of fs_bdev_register. the way that it works is you drop one claim on the {dev, sb} entry β yes, just one, it's not greedy β and the last claim is the one that actually unregisters it. also important: if there's a pinning cursor hanging around, the actual unlink gets deferred. it's giving "i'll get to it later" energy π
the big thing: this does not close the device. not even a little. so if you're a caller who has to do stuff with the still-open device between unregistering and closing β think re-allowing freezing on one that got denied for a membership change β you pair this with bdev_fput. that's the combo move, iykyk π₯
and if you just want the normal "unregister AND close" situation? that's fs_bdev_file_release, the common one. she's the everyday queen π
π SEE ALSO π
everything else in the superblock cinematic universe, fr fr β Kernel file ./fs/super.c:
super_lock(9)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_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)
ok that's the whole page π go forth and unregister responsibly, and remember: don't close the device, that's somebody else's job π§
βΏ this lil masterpiece lives in ./fs βΏ and it's dated October 2026 β yes we're being time travellers about it, slay βπ
π¦ 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