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 sufile during recovery

nilfs_sufile_free() returns the error code -ENOENT when the block where
the segment usage should be placed does not exist (hole block case), but
this error should not be propagated upwards to the mount system call.

In nilfs_prepare_segment_for_recovery(), one of the recovery steps during
mount, nilfs_sufile_free() is used and may return -ENOENT as is, so in
that case return -EINVAL instead.

Link: https://lkml.kernel.org/r/20240821154627.11848-4-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
5b527d38 d07d8ba4

+10 -1
+10 -1
fs/nilfs2/recovery.c
··· 433 433 * The next segment is invalidated by this recovery. 434 434 */ 435 435 err = nilfs_sufile_free(sufile, segnum[1]); 436 - if (unlikely(err)) 436 + if (unlikely(err)) { 437 + if (err == -ENOENT) { 438 + nilfs_err(sb, 439 + "checkpoint log inconsistency at block %llu (segment %llu): next segment %llu is unallocated", 440 + (unsigned long long)nilfs->ns_last_pseg, 441 + (unsigned long long)nilfs->ns_segnum, 442 + (unsigned long long)segnum[1]); 443 + err = -EINVAL; 444 + } 437 445 goto failed; 446 + } 438 447 439 448 for (i = 1; i < 4; i++) { 440 449 err = nilfs_segment_list_add(head, segnum[i]);