]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: undo ext4_calc_metadata_amount if we fail to claim space
authorTheodore Ts'o <tytso@mit.edu>
Mon, 23 Jul 2012 04:00:20 +0000 (00:00 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 23 Jul 2012 04:00:20 +0000 (00:00 -0400)
commit3d38be3fe5c106cc02a3a6605bac94cb22dad192
tree820ff487cef7ff214ac245764e74926177d06702
parent4d1e7dec366e2d31506a4486704638818fc1a586
ext4: undo ext4_calc_metadata_amount if we fail to claim space

The function ext4_calc_metadata_amount() has side effects, although
it's not obvious from its function name.  So if we fail to claim
space, regardless of whether we retry to claim the space again, or
return an error, we need to undo these side effects.

Otherwise we can end up incorrectly calculating the number of metadata
blocks needed for the operation, which was responsible for an xfstests
failure for test #271 when using an ext2 file system with delalloc
enabled.

Reported-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org
fs/ext4/inode.c