On Tue, Mar 15, 2022 at 04:01:45PM +0800, zhanchengbin wrote: > If the system crashes when a file is being truncated, we will get a > problematic inode, > and it will be added into fs->super->s_last_orphan. > When we run `e2fsck -a img`, the s_last_orphan list will be traversed and > deleted. > During this period, orphan inodes in the s_last_orphan list with > i_links_count==0 can > be deleted, and orphan inodes with i_links_count !=0 (ex. the truncated > inode) > cannot be deleted. However, when there are some orphan inodes with > i_links_count !=0, > the EXT2_VALID_FS is still assigned to fs->super->s_state, the deeper > checkers are skipped > with some inconsistency problems. That's not supposed to happen. We regularly put inodes on the orphan list when they are being truncated so that if we crash, the truncation operation can be completed as part of the journal recovery and remount operation. This is true regardles sof whether the recovery is done by e2fsck or by the kernel. If a crash during a truncate leads to an inconsistent file system after the file system is mounted, or after e2fsck does the journal replay and orphan inode list processing, that's a kernel bug, and we should fix the bug in the kernel. Do you have a reliable reproducer for this situation? Thanks, - Ted