gfs2_trans_drain(9)
π
gfs2_trans_drain β wait, hold up, lemme explain
Okay so bestie, welcome to the Kernel API Manual β¨ β this one's a little function with a big job, and it's called gfs2_trans_drain. No cap, the name literally tells you what it does, but let's get into it π
πΈ NAME πΈ
gfs2_trans_drain β drain the buf and databuf queue for a failed transaction ππ
β¨ SYNOPSIS β¨
void gfs2_trans_drain (struct gfs2_sbd *sdp , struct gfs2_trans *tr );
She returns void, she takes two args, she's iconic, periodt π
π¦ ARGUMENTS π¦
sdpβ the filesystem, fr fr. This is thestruct gfs2_sbd *you're working with π«Άtrβ the transaction to drain. That's yourstruct gfs2_trans *, and it's the one getting the cleanup treatment π§Ή
π DESCRIPTION π
Okay so picture this: something went wrong π. When this is called, we're taking an error exit for a log write that failed. And here's the thing β since we bypassed the after_commit functions, nobody cleaned up after themselves π.
So now we gotta do it manually: we need to remove the items from the buf and databuf queue. That's the whole vibe check. She drains, she leaves, she doesn't text back π
β¨
Lowkey important: this is an error-path function β you're only here because a log write failed and the normal commit cleanup got skipped. No guessing, that's literally what the manpage says π«‘
π₯ SEE ALSO π₯
Kernel file ./fs/gfs2/log.c (go read it, iykyk π), plus this whole squad of friends:
gfs2_struct2blk(9)gfs2_remove_from_ail(9)gfs2_ail1_start_one(9)gfs2_ail1_flush(9)gfs2_ail1_start(9)gfs2_ail1_empty_one(9)gfs2_ail1_empty(9)gfs2_log_is_empty(9)gfs2_log_release_revokes(9)gfs2_log_release(9)__gfs2_log_try_reserve(9)__gfs2_log_reserve(9)gfs2_log_try_reserve(9)gfs2_log_reserve(9)log_distance(9)calc_reserved(9)gfs2_flush_revokes(9)gfs2_write_log_header(9)log_write_header(9)gfs2_ail_drain(9)empty_ail1_list(9)__gfs2_log_flush(9)gfs2_merge_trans(9)gfs2_log_commit(9)gfs2_log_shutdown(9)gfs2_logd(9)
mwah π that's the page! She lives in ./fs/gfs2, and this edition dropped October 2026 πβ Go forth and drain those queues, bestie β you got this π«Άπ
π¦ 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