Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nilfs2: do not propagate ENOENT error from nilfs_sufile_mark_dirty()

nilfs_sufile_mark_dirty(), which marks a block in the sufile metadata file
as dirty in preparation for log writing, returns -ENOENT to the caller if
the block containing the segment usage of the specified segment is
missing.

This internal code can propagate through the log writer to system calls
such as fsync. To prevent this, treat this case as a filesystem error and
return -EIO instead.

Link: https://lkml.kernel.org/r/20240821154627.11848-6-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Ryusuke Konishi and committed by
Andrew Morton
d18e4233 0b9aad46

+8 -1
+8 -1
fs/nilfs2/sufile.c
··· 513 513 514 514 down_write(&NILFS_MDT(sufile)->mi_sem); 515 515 ret = nilfs_sufile_get_segment_usage_block(sufile, segnum, 0, &bh); 516 - if (ret) 516 + if (unlikely(ret)) { 517 + if (ret == -ENOENT) { 518 + nilfs_error(sufile->i_sb, 519 + "segment usage for segment %llu is unreadable due to a hole block", 520 + (unsigned long long)segnum); 521 + ret = -EIO; 522 + } 517 523 goto out_sem; 524 + } 518 525 519 526 kaddr = kmap_local_page(bh->b_page); 520 527 su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr);