diff mbox

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

Message ID 1304563444-4842-1-git-send-email-sanbai@taobao.com
State Not Applicable, archived
Headers show

Commit Message

Robin Dong May 5, 2011, 2:44 a.m. UTC
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>
Reviewed-by: Coly Li <bosong.ly@taobao.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
---
 fs/ext2/super.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Jan Kara May 5, 2011, 11:23 a.m. UTC | #1
On Thu 05-05-11 10:44:04, Robin Dong wrote:
> 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>
> Reviewed-by: Coly Li <bosong.ly@taobao.com>
> Reviewed-by: Eric Sandeen <sandeen@redhat.com>
  Thanks. Merged into my tree.

								Honza
diff mbox

Patch

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index d89e0b6..8dfae33 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -882,7 +882,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;
 		}