[PATCH] ext4: Do not dec quota for reserved blocks on error paths

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dmitry Monakhov
Date: Monday, April 26, 2010 - 9:47 pm

If we have failed some where inside ext4_get_blocks() internals we may
have allocated some new blocks, which was not yet claimed to quota.
We have to free such blocks, but without touching quota. Quota will
be updated later on exit from ext4_get_blocks().
There are two possible ways to understand what we have to skip quota update:
1) Caller pass corresponding flag to ext4_free_blocks()
2) check that free_blocks() was indirectly called by get_blocks() 
   (i.e EXT4_I(inode)->i_delalloc_reserved_flag is set)
Second is simpler, but may result in unpredictable consequences later.
So i've chosen the first one, because caller must know which blocks it
is freeing.

The bug happens on heavily loaded node, or with 227'th xfstestcase and
result in incorrect i_blocks (less than expected). So truncation for
that file result in i_blocks overflow.
Seems this was the last bug which was easily triggered by 227'th testcase.

Test hosts survived for 24hrs without complain. Tested configuration:
* ext3 over ext4driver with -odelalloc mount option
* ext4 with default mount opt
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] ext4: Do not dec quota for reserved blocks on erro ..., Dmitry Monakhov, (Mon Apr 26, 9:47 pm)
Re: [PATCH] ext4: Do not dec quota for reserved blocks on ..., Dmitry Monakhov, (Tue Apr 27, 12:14 am)
ext4: Do not dec quota for reserved blocks on error paths v2, Dmitry Monakhov, (Wed Apr 28, 9:53 am)