aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2008-01-28 23:58:27 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-01-28 23:58:27 -0500
commitce40733ce93de402ed629762f0e912d9af187cef (patch)
treeb52c78ac15120151ea688550ba4f6ce619d471c0 /fs/ext4
parentcb45bbe44b09f35bb12d67ffa7ecff862608aeae (diff)
ext4: Check for return value from sb_set_blocksize
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@linux.vnet.ibm.com> Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/super.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 00560cfa519d..055a0cd0168e 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1812,7 +1812,6 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1812 unsigned long def_mount_opts; 1812 unsigned long def_mount_opts;
1813 struct inode *root; 1813 struct inode *root;
1814 int blocksize; 1814 int blocksize;
1815 int hblock;
1816 int db_count; 1815 int db_count;
1817 int i; 1816 int i;
1818 int needs_recovery; 1817 int needs_recovery;
@@ -1969,20 +1968,16 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1969 goto failed_mount; 1968 goto failed_mount;
1970 } 1969 }
1971 1970
1972 hblock = bdev_hardsect_size(sb->s_bdev);
1973 if (sb->s_blocksize != blocksize) { 1971 if (sb->s_blocksize != blocksize) {
1974 /* 1972
1975 * Make sure the blocksize for the filesystem is larger 1973 /* Validate the filesystem blocksize */
1976 * than the hardware sectorsize for the machine. 1974 if (!sb_set_blocksize(sb, blocksize)) {
1977 */ 1975 printk(KERN_ERR "EXT4-fs: bad block size %d.\n",
1978 if (blocksize < hblock) { 1976 blocksize);
1979 printk(KERN_ERR "EXT4-fs: blocksize %d too small for "
1980 "device blocksize %d.\n", blocksize, hblock);
1981 goto failed_mount; 1977 goto failed_mount;
1982 } 1978 }
1983 1979
1984 brelse (bh); 1980 brelse (bh);
1985 sb_set_blocksize(sb, blocksize);
1986 logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE; 1981 logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;
1987 offset = do_div(logical_sb_block, blocksize); 1982 offset = do_div(logical_sb_block, blocksize);
1988 bh = sb_bread(sb, logical_sb_block); 1983 bh = sb_bread(sb, logical_sb_block);