]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: fix hole punch failure when depth is greater than 0
authorAshish Sangwan <ashishsangwan2@gmail.com>
Mon, 23 Jul 2012 02:49:08 +0000 (22:49 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 23 Jul 2012 02:49:08 +0000 (22:49 -0400)
commit4faa9e794d803fd127f296e318de4562a1529318
treed9cb2adcb71b5b00fed42dcb6c7fc55f57e0b7ce
parentd7d2f70b5220b5163fc317f4f25c1ce3f419d235
ext4: fix hole punch failure when depth is greater than 0

Whether to continue removing extents or not is decided by the return
value of function ext4_ext_more_to_rm() which checks 2 conditions:
a) if there are no more indexes to process.
b) if the number of entries are decreased in the header of "depth -1".

In case of hole punch, if the last block to be removed is not part of
the last extent index than this index will not be deleted, hence the
number of valid entries in the extent header of "depth - 1" will
remain as it is and ext4_ext_more_to_rm will return 0 although the
required blocks are not yet removed.

This patch fixes the above mentioned problem as instead of removing
the extents from the end of file, it starts removing the blocks from
the particular extent from which removing blocks is actually required
and continue backward until done.

Signed-off-by: Ashish Sangwan <ashish.sangwan2@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Cc: stable@vger.kernel.org
fs/ext4/extents.c