Whamcloud - gitweb
libext2fs: correctly write up the backup superblocks in big endian systems
authorTheodore Ts'o <tytso@mit.edu>
Sun, 4 Jun 2017 22:37:31 +0000 (18:37 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 4 Jun 2017 22:37:31 +0000 (18:37 -0400)
commitebc8d3cae876a070ea1e4bf3e4fde4112fe2bad1
treefff207cb8c9c677da5c8c2cae9cea328c4d3340d
parent245831ad9abc725518c3c9506460e1a25446a27e
libext2fs: correctly write up the backup superblocks in big endian systems

This bug has been around since we added support for metadata
checksums, but it was unmasked by commit bf9f3b6d5b ("e2fsck: exit
with exit status 0 if no errors were fixed").  The backup superblocks
are not supposed to have the EXT2_VALID_FS or the NEEDS_RECOVERY bits
set, and earlier 1.43.x versions of e2fsprogs were byte swapping the
shadow superblock each time it was written, so that every other backup
superblock was incorrectly byte swapped.

Fortunately the primary backup superblock was correctly written
(modulo having the VALID_FS bit set when it should not have been set)
so for the most part no one noticed.  And very few architectures use
big endian byte ordering these days.  (Even IBM has seen the light
with the ppcle architecture.  :-)

Fortunately commit bf9f3b6d5b caused f_desc_size_bad and
f_resize_inode to fail on a big endian system, which allowed me to
notice the issue and investigate.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/closefs.c