]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
ext4: update reserved space after the 'correction'
authorLukas Czerner <lczerner@redhat.com>
Mon, 11 Mar 2013 02:46:30 +0000 (22:46 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 11 Mar 2013 02:46:30 +0000 (22:46 -0400)
commit232ec8720d4e45405e37144c67053042c6b886d3
treefdbf80788cb229f586d38549ca0655d1843022c0
parentbb8b20ed94bc69120e31399c43cb336300dea109
ext4: update reserved space after the 'correction'

Currently in ext4_ext_map_blocks() in delayed allocation writeback
we would update the reservation and after that check whether we claimed
cluster outside of the range of the allocation and if so, we'll give the
block back to the reservation pool.

However this also means that if the number of reserved data block
dropped to zero before the correction, we would release all the metadata
reservation as well, however we might still need it because the we're
not done with the delayed allocation and there might be more blocks to
come. This will result in error messages such as:

EXT4-fs warning (device sdb): ext4_da_update_reserve_space:361: ino 12,
allocated 1 with only 0 reserved metadata blocks (releasing 1 blocks
with reserved 1 data blocks)

This will only happen on bigalloc file system and it can be easily
reproduced using fiemap-tester from xfstests like this:

./src/fiemap-tester -m DHDHDHDHD -S -p0 /mnt/test/file

Or using xfstests such as 225.

Fix this by doing the correction first and updating the reservation
after that so that we do not accidentally decrease
i_reserved_data_blocks to zero.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/extents.c