linux/fs/ext4
Eric Sandeen fb0a387dcd ext4: limit block allocations for indirect-block files to < 2^32
Today, the ext4 allocator will happily allocate blocks past
2^32 for indirect-block files, which results in the block
numbers getting truncated, and corruption ensues.

This patch limits such allocations to < 2^32, and adds
BUG_ONs if we do get blocks larger than that.

This should address RH Bug 519471, ext4 bitmap allocator 
must limit blocks to < 2^32

* ext4_find_goal() is modified to choose a goal < UINT_MAX,
  so that our starting point is in an acceptable range.

* ext4_xattr_block_set() is modified such that the goal block
  is < UINT_MAX, as above.

* ext4_mb_regular_allocator() is modified so that the group
  search does not continue into groups which are too high

* ext4_mb_use_preallocated() has a check that we don't use
  preallocated space which is too far out

* ext4_alloc_blocks() and ext4_xattr_block_set() add some BUG_ONs

No attempt has been made to limit inode locations to < 2^32,
so we may wind up with blocks far from their inodes.  Doing
this much already will lead to some odd ENOSPC issues when the
"lower 32" gets full, and further restricting inodes could
make that even weirder.

For high inodes, choosing a goal of the original, % UINT_MAX,
may be a bit odd, but then we're in an odd situation anyway,
and I don't know of a better heuristic.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-16 14:45:10 -04:00
..
acl.c ext[234]: move over to 'check_acl' permission model 2009-09-08 11:09:04 -07:00
acl.h ext[234]: move over to 'check_acl' permission model 2009-09-08 11:09:04 -07:00
balloc.c ext4: open-code ext4_mb_update_group_info 2009-08-17 23:51:29 -04:00
bitmap.c ext4: Change unsigned long to unsigned int 2008-11-05 00:14:04 -05:00
block_validity.c ext4: Add a comprehensive block validity check to ext4_get_blocks() 2009-05-17 15:38:01 -04:00
dir.c ext4: Define a new set of flags for ext4_get_blocks() 2009-05-14 00:58:52 -04:00
ext4_extents.h ext4: Show unwritten extent flag in ext4_ext_show_leaf() 2009-09-18 13:34:55 -04:00
ext4_jbd2.c ext4: Assure that metadata blocks are written during fsync in no journal mode 2009-09-12 13:41:55 -04:00
ext4_jbd2.h ext4: Fix buffer head reference leak in no-journal mode 2009-07-13 09:07:20 -04:00
ext4.h ext4: limit block allocations for indirect-block files to < 2^32 2009-09-16 14:45:10 -04:00
extents.c ext4: fix extent sanity checking code with AGGRESSIVE_TEST 2009-08-28 10:40:33 -04:00
file.c ext4: Remove syncing logic from ext4_file_write 2009-09-14 17:08:16 +02:00
fsync.c ext4: Assure that metadata blocks are written during fsync in no journal mode 2009-09-12 13:41:55 -04:00
hash.c ext4: Add support for non-native signed/unsigned htree hash algorithms 2008-10-28 13:21:44 -04:00
ialloc.c ext4: fix build warning when EXT4FS_DEBUG is on 2009-07-27 21:44:40 -04:00
inode.c ext4: limit block allocations for indirect-block files to < 2^32 2009-09-16 14:45:10 -04:00
ioctl.c ext4: Return exchanged blocks count to user space in failure 2009-09-05 22:46:29 -04:00
Kconfig ext4: Add configurable run-time mballoc debugging 2009-09-18 13:38:55 -04:00
Makefile ext4: online defrag -- Add EXT4_IOC_MOVE_EXT ioctl 2009-06-17 19:24:03 -04:00
mballoc.c ext4: limit block allocations for indirect-block files to < 2^32 2009-09-16 14:45:10 -04:00
mballoc.h ext4: use ext4_grpblk_t more extensively 2009-08-25 22:36:45 -04:00
migrate.c ext4: Add missing unlock_new_inode() call in extent migration code 2009-08-25 22:36:05 -04:00
move_extent.c ext4: Fix different block exchange issue in EXT4_IOC_MOVE_EXT 2009-09-16 14:25:39 -04:00
namei.c ext4: Always set dx_node's fake_dirent explicitly. 2009-09-10 23:16:07 -04:00
resize.c ext4: Clarify the locking details in mballoc 2009-09-09 23:50:17 -04:00
super.c ext4: limit block allocations for indirect-block files to < 2^32 2009-09-16 14:45:10 -04:00
symlink.c ext4: Rename ext4dev to ext4 2008-10-10 20:02:48 -04:00
xattr_security.c
xattr_trusted.c
xattr_user.c
xattr.c ext4: limit block allocations for indirect-block files to < 2^32 2009-09-16 14:45:10 -04:00
xattr.h ext4: Rename ext4dev to ext4 2008-10-10 20:02:48 -04:00