Whamcloud - gitweb
e2fsck: handle s_inodes_count corruption properly
authorJan Kara <jack@suse.cz>
Tue, 19 Jun 2018 15:23:37 +0000 (11:23 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 19 Jun 2018 15:27:45 +0000 (11:27 -0400)
commitd74eb7ef5e4ef9590af56744dd8915edf1a4ea12
tree37697caa4000793188547e0db671a351910a9657
parent35b459ffd7b8b60671debe7233d5c558db1afafd
e2fsck: handle s_inodes_count corruption properly

When s_inodes_count would overflow given number of groups and inodes per
group, we cannot currently fix the breakage in e2fsck as that requires
trimming number of groups or inodes per group which both means data &
inode migration etc. Just trimming sb->s_inodes_count is not enough as
kernel's inode allocation code is not able to handle filesystems where
not all inodes in the last group are usable. So don't pretend we can fix
s_inodes_count overflow by just trimming the s_inodes_count value.

When s_inodes_count is just wrong but will not overflow, let's fix it.
Also move this check before we use s_inodes_count for checking
s_first_ino.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/problem.c
e2fsck/problem.h
e2fsck/super.c