diff options
author | Eric Sandeen <sandeen@redhat.com> | 2009-08-17 23:48:51 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-08-17 23:48:51 -0400 |
commit | bf43d84b185e2ff54598f8c58a5a8e63148b6e90 (patch) | |
tree | 1e7a7ca7e5d328c41ef6757ea33d709d8e47fcfb /fs | |
parent | 0ccff1a49def92d6b838a6da166c89004b3a4d0c (diff) |
ext4: reject too-large filesystems on 32-bit kernels
ext4 will happily mount a > 16T filesystem on a 32-bit box, but
this is not safe; writes to the block device will wrap past 16T
and the page cache can't index past 16T (232 index * 4k pages).
Adding another test to the existing "too many sectors" test
should do the trick.
Add a comment, a relevant return value, and fix the reference
to the CONFIG_LBD(AF) option as well.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/super.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index fe3f376b7df2..de67c3657b83 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2550,12 +2550,19 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
2550 | goto failed_mount; | 2550 | goto failed_mount; |
2551 | } | 2551 | } |
2552 | 2552 | ||
2553 | if (ext4_blocks_count(es) > | 2553 | /* |
2554 | (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) { | 2554 | * Test whether we have more sectors than will fit in sector_t, |
2555 | * and whether the max offset is addressable by the page cache. | ||
2556 | */ | ||
2557 | if ((ext4_blocks_count(es) > | ||
2558 | (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) || | ||
2559 | (ext4_blocks_count(es) > | ||
2560 | (pgoff_t)(~0ULL) >> (PAGE_CACHE_SHIFT - sb->s_blocksize_bits))) { | ||
2555 | ext4_msg(sb, KERN_ERR, "filesystem" | 2561 | ext4_msg(sb, KERN_ERR, "filesystem" |
2556 | " too large to mount safely"); | 2562 | " too large to mount safely on this system"); |
2557 | if (sizeof(sector_t) < 8) | 2563 | if (sizeof(sector_t) < 8) |
2558 | ext4_msg(sb, KERN_WARNING, "CONFIG_LBDAF not enabled"); | 2564 | ext4_msg(sb, KERN_WARNING, "CONFIG_LBDAF not enabled"); |
2565 | ret = -EFBIG; | ||
2559 | goto failed_mount; | 2566 | goto failed_mount; |
2560 | } | 2567 | } |
2561 | 2568 | ||