e2fsprogs/lib
Darrick J. Wong b9f95911e9 libext2fs: don't cache inodes that fail checksum verification
If an inode fails checksum verification, don't stuff a copy of it in
the inode cache, because this can cause the library to fail to return
the "corrupt inode" error code.

In general, this happens if ext2fs_read_inode_full() is called twice
on an inode with an incorrect checksum.  If fs->flags has
EXT2_FLAG_IGNORE_CSUM_ERRORS set during the first call and *unset*
during the second call, the cache hit during the second call fails to
return EXT2_ET_INODE_CSUM_INVALID as you'd expect.  This happens
during fsck because the first read_inode call happens as part of
check_blocks and the second call happens during inode checksum
revalidation.  A file system with a slightly corrupt non-extent inode
will trigger this.

While we're at it, make the inode read function consistent with the
rest of libext2fs -- copy the metadata object into the caller's buffer
even if it fails checksum verification.  This will help e2fsck avoid a
double re-read later on down the line.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-08-02 22:49:23 -04:00
..
blkid Merge branch 'maint' into next 2014-07-22 14:57:40 -04:00
e2p Merge branch 'maint' into next 2014-07-06 00:09:27 -04:00
et Merge branch 'maint' into next 2014-07-06 00:09:27 -04:00
ext2fs libext2fs: don't cache inodes that fail checksum verification 2014-08-02 22:49:23 -04:00
quota Merge branch 'maint' into next 2014-07-26 09:46:50 -04:00
ss Merge branch 'maint' into next 2014-07-06 00:09:27 -04:00
uuid Merge branch 'maint' into next 2014-07-06 00:09:27 -04:00
Makefile.bsd-lib Include LDFLAGS when building BSD libraries 2012-05-11 22:21:08 -04:00
Makefile.checker e2fsprogs: remove checker infrastructure 2014-07-04 23:59:30 -04:00
Makefile.darwin-lib Add configure options --enable-symlink-build and --enable-symlink-install 2010-05-17 19:21:42 -04:00
Makefile.elf-lib Put ELF_OTHER_LIBS in the right place for the linker 2012-08-06 12:30:49 -04:00
Makefile.library Add configure options --enable-symlink-build and --enable-symlink-install 2010-05-17 19:21:42 -04:00
Makefile.profile Add configure options --enable-symlink-build and --enable-symlink-install 2010-05-17 19:21:42 -04:00
Makefile.solaris-lib Put ELF_OTHER_LIBS in the right place for the linker 2012-08-06 12:30:49 -04:00
config.h.in Merge branch 'maint' into next 2014-08-02 22:05:03 -04:00
dirpaths.h.in Shorten compile commands run by the build system 2011-09-18 17:34:37 -04:00
fpopen.c Shorten compile commands run by the build system 2011-09-18 17:34:37 -04:00