Whamcloud - gitweb
libext2fs: when checking the inode's checksum, allow an all-zero inode
authorTheodore Ts'o <tytso@mit.edu>
Fri, 3 Aug 2012 00:47:46 +0000 (20:47 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 3 Aug 2012 00:47:46 +0000 (20:47 -0400)
commit97fac35094160261907eeb693498ef6ebd27283e
tree6187e8c254a1d3cca2de6c3b23b8faaed9993bd2
parente748f4b4fa04c8e653c205f440fc43d2b5e882db
libext2fs: when checking the inode's checksum, allow an all-zero inode

When the kernel writes an inode where all of the other inodes in in
the inode table (itable) block are unused, it skips reading the itable
block from disk, and instead uses an all zeros block.  This can cause
e2fsck to complain when it iterates over the inodes using
ext2fs_get_next_inode() since the inode apparently has an invalid
checksum.  Normally the inode won't be returned at all if it is at the
end of the block group's part of the inode table, thanks to the
bg_itable_unused field.  But it's possible for this situation to
happen earlier in the inode table block.

Fix this by changing ext2fs_inode_csum_verify() to allow the inode to
be all zero's; if the checksum fails, and the inode is all zero's,
treat it as a valid checksum.

Reported-by: Tao Ma <boyu.tm@taobao.com>
Reported-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/csum.c