diff -r -u linux-stage.orig/fs/ext4/super.c linux-stage/fs/ext4/super.c --- linux-stage.orig/fs/ext4/super.c 2012-12-31 12:55:18.000000000 -0500 +++ linux-stage/fs/ext4/super.c 2012-12-31 12:56:14.000000000 -0500 @@ -59,6 +59,8 @@ static struct mutex ext4_li_mtx; static struct ext4_features *ext4_feat; +static int force_over_128tb; + static int ext4_load_journal(struct super_block *, struct ext4_super_block *, unsigned long journal_devnum); static int ext4_commit_super(struct super_block *sb, int sync); @@ -1298,7 +1300,7 @@ Opt_nomblk_io_submit, Opt_block_validity, Opt_noblock_validity, Opt_inode_readahead_blks, Opt_journal_ioprio, Opt_dioread_nolock, Opt_dioread_lock, - Opt_mballoc, Opt_bigendian_extents, + Opt_mballoc, Opt_bigendian_extents, Opt_force_over_128tb, Opt_discard, Opt_nodiscard, Opt_init_itable, Opt_noinit_itable, }; @@ -1374,6 +1376,7 @@ {Opt_dioread_nolock, "dioread_nolock"}, {Opt_dioread_lock, "dioread_lock"}, {Opt_bigendian_extents, "bigendian_extents"}, + {Opt_force_over_128tb, "force_over_128tb"}, {Opt_mballoc, "mballoc"}, {Opt_discard, "discard"}, {Opt_nodiscard, "nodiscard"}, @@ -1879,6 +1882,9 @@ break; case Opt_mballoc: break; + case Opt_force_over_128tb: + force_over_128tb = 1; + break; default: ext4_msg(sb, KERN_ERR, "Unrecognized mount option \"%s\" " @@ -3394,6 +3400,16 @@ goto failed_mount; } + if (ext4_blocks_count(es) > (8ULL << 32)) { + if (force_over_128tb == 0) { + printk(KERN_ERR "EXT4-fs does not support filesystems " + "greater than 128TB and can cause data corruption." + "Use \"force_over_128tb\" mount option to override." + "\n"); + goto failed_mount; + } + } + if (EXT4_BLOCKS_PER_GROUP(sb) == 0) goto cantfind_ext4;