get_master_node(9)
π get_master_node(9) β a Kernel API Manual moment
okay so bestie, welcome to get_master_node(9), straight out of the Kernel API Manual. this one's giving "recovery era" and honestly it's so iconic for it. let's get into it π
β¨ NAME β¨
get_master_node β grab the last valid master node, and yes it's literally built different so it can survive a little corruption π
π¦ SYNOPSIS π¦
int get_master_node (const struct ubifs_info *c , int lnum , void **pbuf
, struct ubifs_mst_node **mst , void **cor );
πΈ ARGUMENTS πΈ
cβ the UBIFS file-system description object, your main character struct frlnumβ LEB number πpbufβ the buffer holding the LEB that was read; it gets returned to you right here π«Άmstβ the master node β if one's found, it comes back to you here β¨corβ the corruption β if there is any, it's handed back to you here π
π DESCRIPTION π
so what this function does is: it allocates a buffer, reads the LEB into it, and then finds and returns the last valid master node, allowing for exactly one area of corruption. one. singular. don't push it π
the corrupt area β if there even is one β has to be consistent with the assumption that it's the result of an unclean unmount while the master node was being written. like, that's the whole vibe check it has to pass. and under those circumstances, it is valid to use the previously written master node. slay, honestly.
this function returns 0 on success and a negative error code on failure. periodt π
π SEE ALSO π
Kernel file ./fs/ubifs/recovery.c is out here with the whole friend group: is_empty(9), first_non_ff(9), write_rcvrd_mst_node(9), ubifs_recover_master_node(9), ubifs_write_rcvrd_mst_node(9), is_last_write(9), clean_buf(9), no_more_nodes(9), fix_unclean_leb(9), drop_last_group(9), drop_last_node(9), ubifs_recover_leb(9), get_cs_sqnum(9), ubifs_recover_log_leb(9), recover_head(9), ubifs_recover_inl_heads(9), clean_an_unclean_leb(9), ubifs_clean_lebs(9), grab_empty_leb(9), ubifs_rcvry_gc_commit(9), struct size_entry(9), add_ino(9), find_ino(9), remove_ino(9), ubifs_destroy_size_tree(9), ubifs_recover_size_accum(9), fix_size_in_place(9), inode_fix_size(9), ubifs_recover_size(9) β the whole roster, no cap π₯
ngl this page lives in./fs/ubifs, dated October 2026, and it's still signing off asget_master_node(9). π§ take care of her, she's doing important recovery work π
π¦ 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