The patch titled ext4: check for return value from sb_set_blocksize has been added to the -mm tree. Its filename is ext4-check-for-return-value-from-sb_set_blocksize.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: ext4: check for return value from sb_set_blocksize From: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx> sb_set_blocksize validates whether the specfied block size can be used by the file system. Make sure we fail mounting the file system if the blocksize specfied cannot be used. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/ext4/super.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff -puN fs/ext4/super.c~ext4-check-for-return-value-from-sb_set_blocksize fs/ext4/super.c --- a/fs/ext4/super.c~ext4-check-for-return-value-from-sb_set_blocksize +++ a/fs/ext4/super.c @@ -1793,7 +1793,6 @@ static int ext4_fill_super (struct super unsigned long def_mount_opts; struct inode *root; int blocksize; - int hblock; int db_count; int i; int needs_recovery; @@ -1947,20 +1946,16 @@ static int ext4_fill_super (struct super goto failed_mount; } - hblock = bdev_hardsect_size(sb->s_bdev); if (sb->s_blocksize != blocksize) { - /* - * Make sure the blocksize for the filesystem is larger - * than the hardware sectorsize for the machine. - */ - if (blocksize < hblock) { - printk(KERN_ERR "EXT4-fs: blocksize %d too small for " - "device blocksize %d.\n", blocksize, hblock); + + /* Validate the filesystem blocksize */ + if (!sb_set_blocksize(sb, blocksize)) { + printk(KERN_ERR "EXT4-fs: bad block size %d.\n", + blocksize); goto failed_mount; } brelse (bh); - sb_set_blocksize(sb, blocksize); logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE; offset = do_div(logical_sb_block, blocksize); bh = sb_bread(sb, logical_sb_block); _ Patches currently in -mm which might be from aneesh.kumar@xxxxxxxxxxxxxxxxxx are ext2-return-after-ext2_error-in-case-of-failures.patch ext2-change-the-default-behaviour-on-error.patch add-buffer-head-related-helper-functions.patch ext2-add-block-bitmap-validation.patch ext3-add-block-bitmap-validation.patch ext4-check-for-return-value-from-sb_set_blocksize.patch ext3-return-after-ext3_error-in-case-of-failures.patch ext3-change-the-default-behaviour-on-error.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html