Skip to content

Commit d18e423

Browse files
konisakpm00
authored andcommitted
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/[email protected] Signed-off-by: Ryusuke Konishi <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 0b9aad4 commit d18e423

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

fs/nilfs2/sufile.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,15 @@ int nilfs_sufile_mark_dirty(struct inode *sufile, __u64 segnum)
513513

514514
down_write(&NILFS_MDT(sufile)->mi_sem);
515515
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+
}
517523
goto out_sem;
524+
}
518525

519526
kaddr = kmap_local_page(bh->b_page);
520527
su = nilfs_sufile_block_get_segment_usage(sufile, segnum, bh, kaddr);

0 commit comments

Comments
 (0)