summaryrefslogtreecommitdiff
path: root/fs/ext4/resize.c
diff options
context:
space:
mode:
authorMaxim Patlasov <maxim.patlasov@gmail.com>2011-07-10 19:37:48 -0400
committerJonas ABERG <jonas.aberg@stericsson.com>2011-10-28 11:13:23 +0200
commitf126e5768b82f3e115624e089f08ff41f59264a8 (patch)
treed42bbb11e4bf2bea9ec40510836c1801198f1f49 /fs/ext4/resize.c
parentb0ba33f3cd4bd7990fe702e239d3f828ad8cc090 (diff)
ext4: fix i_blocks/quota accounting when extent insertion fails
commit 7132de744ba76930d13033061018ddd7e3e8cd91 upstream. The current implementation of ext4_free_blocks() always calls dquot_free_block This looks quite sensible in the most cases: blocks to be freed are associated with inode and were accounted in quota and i_blocks some time ago. However, there is a case when blocks to free were not accounted by the time calling ext4_free_blocks() yet: 1. delalloc is on, write_begin pre-allocated some space in quota 2. write-back happens, ext4 allocates some blocks in ext4_ext_map_blocks() 3. then ext4_ext_map_blocks() gets an error (e.g. ENOSPC) from ext4_ext_insert_extent() and calls ext4_free_blocks(). In this scenario, ext4_free_blocks() calls dquot_free_block() who, in turn, decrements i_blocks for blocks which were not accounted yet (due to delalloc) After clean umount, e2fsck reports something like: > Inode 21, i_blocks is 5080, should be 5128. Fix<y>? because i_blocks was erroneously decremented as explained above. The patch fixes the problem by passing the new flag EXT4_FREE_BLOCKS_NO_QUOT_UPDATE to ext4_free_blocks(), to request that the dquot_free_block() call be skipped. Signed-off-by: Maxim Patlasov <maxim.patlasov@gmail.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Change-Id: Ifa15e3180eee516984412425556287f5458b3d27 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/35648 Tested-by: Per VAHLNE <per.xx.vahlne@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'fs/ext4/resize.c')
0 files changed, 0 insertions, 0 deletions