Skip to content

Commit 5b527d3

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

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

fs/nilfs2/recovery.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,17 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
433433
* The next segment is invalidated by this recovery.
434434
*/
435435
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+
}
437445
goto failed;
446+
}
438447

439448
for (i = 1; i < 4; i++) {
440449
err = nilfs_segment_list_add(head, segnum[i]);

0 commit comments

Comments
 (0)