ext4: fix unjournalled bg descriptor while initializing inode bitmap
authorTheodore Ts'o <tytso@mit.edu>
Sat, 5 Jul 2014 20:28:35 +0000 (16:28 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2014 23:23:15 +0000 (16:23 -0700)
commit4dc3dd7aceb3d77d14ee798dbf3afde357e4bdb0
treeba5b5ce3639beda0fc8f13afe2cc9d27527a424a
parent390cb9cac7aa522386f66edd034720c3a65bcd82
ext4: fix unjournalled bg descriptor while initializing inode bitmap

commit 61c219f5814277ecb71d64cb30297028d6665979 upstream.

The first time that we allocate from an uninitialized inode allocation
bitmap, if the block allocation bitmap is also uninitalized, we need
to get write access to the block group descriptor before we start
modifying the block group descriptor flags and updating the free block
count, etc.  Otherwise, there is the potential of a bad journal
checksum (if journal checksums are enabled), and of the file system
becoming inconsistent if we crash at exactly the wrong time.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ialloc.c