Whamcloud - gitweb
libext2fs: don't always read backup group descriptors on a 1k-block meta_bg fs
authorDarrick J. Wong <darrick.wong@oracle.com>
Sat, 11 Jan 2014 18:58:15 +0000 (13:58 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 11 Jan 2014 18:58:15 +0000 (13:58 -0500)
commitd36b957b345ee6e4b529be99b8fdc8d3e70ccdc1
treef310e825b54e2a2ff86b56a6772fc2559f9e8c4a
parent6ff02832a069bb832c8a72b949816089ae97b356
libext2fs: don't always read backup group descriptors on a 1k-block meta_bg fs

On a filesystem with 1K blocks and meta_bg enabled, opening a
filesystem with automatic superblock detection tries to compensate for
the fact that the superblock lives in block 1.  However, the method by
which this is done is later misinterpreted to mean "read the backup
group descriptors", which is not what we want in this case.

Therefore, in ext2fs_open3() separate the 'group zero' adjustment into
its own variable so that we don't get fed backup group descriptors
when we try to load meta_bg group descriptors.

Furthermore, enhance ext2fs_descriptor_block_loc2() to perform its own
group zero correction.  The other caller of this function neglects to
do any group-zero correction of their own, so this fixes them too.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/ext2fs.h
lib/ext2fs/openfs.c