file_check_...vance_wb_err(9)
okay bestie, welcome to the file_check_...vance_wb_err(9) page in the Kernel API Manual. this is literally the writeback-error check-and-advance moment, and we're gonna make it make sense. π
β¨
NAME π
file_check_and_advance_wb_err β report wb error (if any) that was previously and advance wb_err to current one. that's the assignment, no cap. π«Ά
SYNOPSIS π¦
the signature is giving kernel API realness:
int file_check_and_advance_wb_err (struct file *file );
ARGUMENTS πΈ
fileβ thestruct fileon which the error is being reported. that's the whole cast, bestie.
DESCRIPTION β¨
okay so here's the tea. when userland calls fsync (or something like nfsd does the equivalent), we want to report any writeback errors that occurred since the last fsync (or since the file was opened if there haven't been any). periodt.
grab the wb_err from the mapping. if it matches what we have in the file, then just quickly return 0. the file is all caught up. iconic, honestly. π
if it doesn't match, then take the mapping value, set the "seen" flag in it and try to swap it into place. if it works, or another task beat us to it with the new value, then update the f_wb_err and return the error portion. the error at this point must be reported via proper channels (a'la fsync, or NFS COMMIT operation, etc.). no skipping that part, bestie. π«Ά
while we handle mapping->wb_err with atomic operations, the f_wb_err value is protected by the f_lock since we must ensure that it reflects the latest value swapped in for this file descriptor. that's the lock lore, and it matters. π₯
RETURN π
0 on success, negative error code otherwise. so: 0 means slay, negative means the vibe check said "there's an error, report it properly." π
SEE ALSO π
go read the whole friend group, bestie:
- Kernel file:
./mm/filemap.c filemap_remove_folio(9)filemap_fdatawrite_range(9)filemap_flush_range(9)filemap_flush(9)filemap_range_has_page(9)filemap_fdatawait_range(9)filemap_fdatawait_range_keep_errors(9)file_fdatawait_range(9)filemap_fdatawait_keep_errors(9)filemap_write_and_wait_range(9)file_write_and_wait_range(9)replace_page_cache_folio(9)softleaf_entry_wait_on_locked(9)folio_put_wait_locked(9)folio_unlock(9)folio_end_read(9)folio_end_private_2(9)folio_wait_private_2(9)folio_wait_private_2_killable(9)folio_end_writeback_no_dropbehind(9)folio_end_writeback(9)__folio_lock(9)page_cache_next_miss(9)page_cache_prev_miss(9)__filemap_get_folio_mpol(9)find_get_entries(9)find_lock_entries(9)filemap_get_folios(9)filemap_get_folios_contig(9)filemap_get_folios_tag(9)filemap_get_folios_dirty(9)filemap_read(9)generic_file_read_iter(9)filemap_splice_read(9)mapping_seek_hole_data(9)filemap_fault(9)read_cache_folio(9)mapping_read_folio_gfp(9)read_cache_page_gfp(9)__generic_file_write_iter(9)generic_file_write_iter(9)filemap_release_folio(9)filemap_invalidate_inode(9)filemap_cachestat(9)
this cutie was signed off from ./mm in October 2026, and the manual name is file_check_...vance_wb_err(9) β 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