Patchwork ext2: fix error msg when mounting fs with too-large blocksize

login
register
mail settings
Submitter Robin Dong
Date April 24, 2011, 6:36 a.m.
Message ID <1303626991-6704-1-git-send-email-hao.bigrat@gmail.com>
Download mbox | patch
Permalink /patch/92637/
State Not Applicable
Headers show

Comments

Robin Dong - April 24, 2011, 6:36 a.m.
From: Robin Dong <sanbai@taobao.com>

When ext2 mounts a filesystem, it attempts to set the block device
blocksize with a call to sb_set_blocksize, which can fail for
several reasons.  The current failure message in ext2 prints:

  EXT2-fs (loop1): error: blocksize is too small

which is not correct in all cases.  This can be demonstrated
by creating a filesystem with

  # mkfs.ext2 -b 8192

on a 4k page system, and attempting to mount it.

Change the error message to a more generic:

  EXT2-fs (loop1): bad blocksize 8192

to match the error message in ext3.

Signed-off-by: Robin Dong <sanbai@taobao.com>
---
 fs/ext2/super.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Coly Li - April 24, 2011, 7:17 a.m.
On 2011年04月24日 14:36, Robin Dong Wrote:
> From: Robin Dong <sanbai@taobao.com>
> 
> When ext2 mounts a filesystem, it attempts to set the block device
> blocksize with a call to sb_set_blocksize, which can fail for
> several reasons.  The current failure message in ext2 prints:
> 
>   EXT2-fs (loop1): error: blocksize is too small
> 
> which is not correct in all cases.  This can be demonstrated
> by creating a filesystem with
> 
>   # mkfs.ext2 -b 8192
> 
> on a 4k page system, and attempting to mount it.
> 
> Change the error message to a more generic:
> 
>   EXT2-fs (loop1): bad blocksize 8192
> 
> to match the error message in ext3.
> 

Reviewed-by: Coly Li <bosong.ly@taobao.com>


> Signed-off-by: Robin Dong <sanbai@taobao.com>
> ---
>  fs/ext2/super.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 0a78dae..1dd62ed 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -898,7 +898,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  		brelse(bh);
>  
>  		if (!sb_set_blocksize(sb, blocksize)) {
> -			ext2_msg(sb, KERN_ERR, "error: blocksize is too small");
> +			ext2_msg(sb, KERN_ERR,
> +				"error: bad blocksize %d", blocksize);
>  			goto failed_sbi;
>  		}
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen - April 25, 2011, 3:11 p.m.
On 4/24/11 1:36 AM, Robin Dong wrote:
> From: Robin Dong <sanbai@taobao.com>
> 
> When ext2 mounts a filesystem, it attempts to set the block device
> blocksize with a call to sb_set_blocksize, which can fail for
> several reasons.  The current failure message in ext2 prints:
> 
>   EXT2-fs (loop1): error: blocksize is too small
> 
> which is not correct in all cases.  This can be demonstrated
> by creating a filesystem with
> 
>   # mkfs.ext2 -b 8192
> 
> on a 4k page system, and attempting to mount it.
> 
> Change the error message to a more generic:
> 
>   EXT2-fs (loop1): bad blocksize 8192
> 
> to match the error message in ext3.

I couldn't have said it better myself :)  As long as you're ok with not having the extra error message you originally had, for now ...

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> Signed-off-by: Robin Dong <sanbai@taobao.com>
> ---
>  fs/ext2/super.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 0a78dae..1dd62ed 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -898,7 +898,8 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  		brelse(bh);
>  
>  		if (!sb_set_blocksize(sb, blocksize)) {
> -			ext2_msg(sb, KERN_ERR, "error: blocksize is too small");
> +			ext2_msg(sb, KERN_ERR,
> +				"error: bad blocksize %d", blocksize);
>  			goto failed_sbi;
>  		}
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 0a78dae..1dd62ed 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -898,7 +898,8 @@  static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 		brelse(bh);
 
 		if (!sb_set_blocksize(sb, blocksize)) {
-			ext2_msg(sb, KERN_ERR, "error: blocksize is too small");
+			ext2_msg(sb, KERN_ERR,
+				"error: bad blocksize %d", blocksize);
 			goto failed_sbi;
 		}