jbd2_journal..._undo_access(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« jbd2_journal..._undo_access(9) πŸ’«

okay bestie, welcome to the Kernel API Manual ✨ this one's about jbd2_journal..._undo_access and honestly it's giving "niche but essential" energy, iykyk πŸ¦‹


πŸŽ€ NAME πŸŽ€

jbd2_journal_get_undo_access β€” the little function that says "hey, i'm about to touch this metadata and the consequences are non-rewindable" πŸ’…


🌸 SYNOPSIS 🌸

int jbd2_journal_get_undo_access (handle_t *handle , struct buffer_head
*bh );

✨ ARGUMENTS ✨

  • handle β€” the transaction, obvi 🫢
  • bh β€” the buffer to undo 🧚

πŸ’– DESCRIPTION πŸ’–

ok so. sometimes you lowkey need to tell the difference between metadata that's already been committed to disk and metadata that has not 😭 like these are two different vibes and you gotta know which is which.

the ext3fs code uses this for freeing and allocating space β€” and bestie, we have to make sure we do not reuse freed space until the deallocation has been committed. because if we overwrote that space, we would make the delete un-rewindable in case of a crash πŸ’€ that's the whole plot twist. no cap.

to deal with that, jbd2_journal_get_undo_access requests write access to a buffer for parts of non-rewindable operations such as delete operations on the bitmaps πŸ”₯ and the journaling code must keep a copy of the buffer's contents prior to the undo_access call until such time as we know that the buffer has definitely been committed to disk. like, hold onto it, don't let go πŸŽ€

here's the slay part: we never need to know which transaction the committed data is part of 🧚 buffers touched here are guaranteed to be dirtied later and so will be committed to a new transaction in due course, at which point we can discard the old committed data pointer. iconic behaviour honestly πŸ‘‘

returns error number or 0 on success ⭐


🌈 SEE ALSO 🌈

kernel file ./fs/jbd2/transaction.c, plus the whole friend group πŸ’œ


and that's the whole page bestie!! 🌸 this lil baddie lives in ./fs/jbd2 πŸ¦‹ it's dated October 2026 πŸŽ€ and it goes by jbd2_journal..._undo_access(9) πŸ’… mwah, go forth and journal responsibly βœ¨πŸ‘‘

πŸ“¦ where this page comes from