Update series file for 2.6.24.
[ext4-patch-queue.git] / ext4_check_for_return_value_from_sb_set_blocksize.patch
blobbe49fb3be026b4afeff611fab0a01be6e7bc8295
1 ext4: Check for return value from sb_set_blocksize
3 From: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
5 sb_set_blocksize validates whether the specfied block size can be used by
6 the file system. Make sure we fail mounting the file system if the
7 blocksize specfied cannot be used.
9 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
10 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
11 ---
13 fs/ext4/super.c | 15 +++++----------
14 1 file changed, 5 insertions(+), 10 deletions(-)
17 Index: linux-2.6.24-rc8/fs/ext4/super.c
18 ===================================================================
19 --- linux-2.6.24-rc8.orig/fs/ext4/super.c 2008-01-25 09:06:07.000000000 -0800
20 +++ linux-2.6.24-rc8/fs/ext4/super.c 2008-01-25 09:09:59.000000000 -0800
21 @@ -1812,7 +1812,6 @@ static int ext4_fill_super (struct super
22 unsigned long def_mount_opts;
23 struct inode *root;
24 int blocksize;
25 - int hblock;
26 int db_count;
27 int i;
28 int needs_recovery;
29 @@ -1969,20 +1968,16 @@ static int ext4_fill_super (struct super
30 goto failed_mount;
33 - hblock = bdev_hardsect_size(sb->s_bdev);
34 if (sb->s_blocksize != blocksize) {
35 - /*
36 - * Make sure the blocksize for the filesystem is larger
37 - * than the hardware sectorsize for the machine.
38 - */
39 - if (blocksize < hblock) {
40 - printk(KERN_ERR "EXT4-fs: blocksize %d too small for "
41 - "device blocksize %d.\n", blocksize, hblock);
43 + /* Validate the filesystem blocksize */
44 + if (!sb_set_blocksize(sb, blocksize)) {
45 + printk(KERN_ERR "EXT4-fs: bad block size %d.\n",
46 + blocksize);
47 goto failed_mount;
50 brelse (bh);
51 - sb_set_blocksize(sb, blocksize);
52 logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;
53 offset = do_div(logical_sb_block, blocksize);
54 bh = sb_bread(sb, logical_sb_block);