linux/fs/ext4
Omar Sandoval 6f30b7e37a ext4: fix indirect punch hole corruption
Commit 4f579ae7de (ext4: fix punch hole on files with indirect
mapping) rewrote FALLOC_FL_PUNCH_HOLE for ext4 files with indirect
mapping. However, there are bugs in several corner cases. This fixes 5
distinct bugs:

1. When there is at least one entire level of indirection between the
start and end of the punch range and the end of the punch range is the
first block of its level, we can't return early; we have to free the
intervening levels.

2. When the end is at a higher level of indirection than the start and
ext4_find_shared returns a top branch for the end, we still need to free
the rest of the shared branch it returns; we can't decrement partial2.

3. When a punch happens within one level of indirection, we need to
converge on an indirect block that contains the start and end. However,
because the branches returned from ext4_find_shared do not necessarily
start at the same level (e.g., the partial2 chain will be shallower if
the last block occurs at the beginning of an indirect group), the walk
of the two chains can end up "missing" each other and freeing a bunch of
extra blocks in the process. This mismatch can be handled by first
making sure that the chains are at the same level, then walking them
together until they converge.

4. When the punch happens within one level of indirection and
ext4_find_shared returns a top branch for the start, we must free it,
but only if the end does not occur within that branch.

5. When the punch happens within one level of indirection and
ext4_find_shared returns a top branch for the end, then we shouldn't
free the block referenced by the end of the returned chain (this mirrors
the different levels case).

Signed-off-by: Omar Sandoval <osandov@osandov.com>
2015-02-14 20:08:51 -05:00
..
acl.c ext2/3/4: use generic posix ACL infrastructure 2014-01-25 23:58:19 -05:00
acl.h ext2/3/4: use generic posix ACL infrastructure 2014-01-25 23:58:19 -05:00
balloc.c ext4: move error report out of atomic context in ext4_init_block_bitmap() 2014-10-13 03:42:12 -04:00
bitmap.c ext4: Replace open coded mdata csum feature to helper function 2014-10-13 03:36:16 -04:00
block_validity.c fs/ext4: use rbtree postorder iteration helper instead of opencoding 2014-01-23 16:37:03 -08:00
dir.c ext4: convert ext4_bread() to use the ERR_PTR convention 2014-08-29 20:52:15 -04:00
ext4.h ext4: support read-only images 2015-02-12 22:31:21 -05:00
ext4_extents.h ext4: teach ext4_ext_find_extent() to realloc path if necessary 2014-09-01 14:40:09 -04:00
ext4_jbd2.c ext4: fix over-defensive complaint after journal abort 2014-10-01 22:23:15 -04:00
ext4_jbd2.h ext4: don't use MAXQUOTAS value 2014-09-11 11:15:15 -04:00
extents.c Revert "ext4: fix suboptimal seek_{data,hole} extents traversial" 2015-01-02 15:16:00 -05:00
extents_status.c ext4: introduce aging to extent status tree 2014-11-25 11:55:24 -05:00
extents_status.h ext4: introduce aging to extent status tree 2014-11-25 11:55:24 -05:00
file.c Revert "ext4: fix suboptimal seek_{data,hole} extents traversial" 2015-01-02 15:16:00 -05:00
fsync.c ext4: Fix fsync error handling after filesystem abort 2013-06-12 22:38:04 -04:00
hash.c ext4: reduce one "if" comparison in ext4_dirhash() 2013-02-01 22:33:21 -05:00
ialloc.c ext4: fix oops when loading block bitmap failed 2014-10-30 10:53:16 -04:00
indirect.c ext4: fix indirect punch hole corruption 2015-02-14 20:08:51 -05:00
inline.c ext4: ext4_da_convert_inline_data_to_extent drop locked page after error 2014-12-05 21:37:15 -05:00
inode.c ext4: fix mmap data corruption in nodelalloc mode when blocksize < pagesize 2015-02-12 23:00:17 -05:00
ioctl.c ext4: move handling of list of shrinkable inodes into extent status code 2014-11-25 11:49:25 -05:00
Kconfig ext4: fix Kconfig documentation for CONFIG_EXT4_DEBUG 2013-04-21 20:32:03 -04:00
Makefile ext4: Remove CONFIG_EXT4_FS_XATTR 2012-12-10 16:30:43 -05:00
mballoc.c ext4: Remove an unnecessary check for NULL before iput() 2014-11-25 20:01:37 -05:00
mballoc.h ext4: remove unused ac_ex_scanned 2014-02-20 13:32:10 -05:00
migrate.c ext4: update comments regarding ext4_delete_inode() 2014-11-25 16:17:29 -05:00
mmp.c ext4: Replace open coded mdata csum feature to helper function 2014-10-13 03:36:16 -04:00
move_extent.c move_extent_per_page(): get rid of unused w_flags 2014-12-17 06:43:56 -05:00
namei.c ext4: remove unneeded code in ext4_unlink 2014-11-25 16:34:38 -05:00
page-io.c Clean ups and miscellaneous bug fixes, in particular for the new 2014-06-08 13:03:35 -07:00
resize.c ext4: prevent online resize with backup superblock 2014-12-26 23:58:21 -05:00
super.c ext4: ignore journal checksum on remount; don't fail 2015-02-12 23:07:37 -05:00
symlink.c ext4: Remove CONFIG_EXT4_FS_XATTR 2012-12-10 16:30:43 -05:00
truncate.h
xattr.c ext4: Replace open coded mdata csum feature to helper function 2014-10-13 03:36:16 -04:00
xattr.h ext4: each filesystem creates and uses its own mb_cache 2014-03-18 19:24:49 -04:00
xattr_security.c
xattr_trusted.c
xattr_user.c