linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: Theodore Tso <tytso@mit.edu>
Cc: akpm@linux-foundation.org, linux-ext4@vger.kernel.org
Subject: Re: + ext2-fix-support-for-empty-directory-blocks-in-64k-blocksize-filesys tems.patch added to -mm tree
Date: Thu, 12 Feb 2009 14:27:50 +0800	[thread overview]
Message-ID: <4993C166.6020905@cn.fujitsu.com> (raw)
In-Reply-To: <20090211150227.GI29220@mini-me.lan>

Theodore Tso wrote:
> On Tue, Feb 10, 2009 at 02:57:58PM -0800, akpm@linux-foundation.org wrote:
>   
>> The patch titled
>>      ext2: fix support for empty directory blocks in 64k blocksize filesystems
>> has been added to the -mm tree.  Its filename is
>>      ext2-fix-support-for-empty-directory-blocks-in-64k-blocksize-filesystems.patch
>>     
>
> NACK.  The commit description is incomplete, we need to discuss more
> what's the best way of handling this.  See the discussion around the
> ext4 patch on linux-ext4 for more details.
>
> This patch is entirely moot for ext2 in any case, since
> EXT2_MAX_BLOCK_SIZE was never changed from 4096.
>   

Hi,  Ted

If you are right, I think this patch is necessary.

[PATCH] ext2: Fix to check unsupported filesystem blocksize

EXT2-fs defined that the max blocksize is:
        #define EXT2_MAX_BLOCK_SIZE	4960
and the min blocksize is:
        #define EXT2_MIN_BLOCK_SIZE	1024

But never check this in ext2_fill_super(). So mount will
always success even if the block size is larger than 4096.

This patch fixed the problem.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
 fs/ext2/super.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index da8bdea..36cdfd6 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -873,6 +873,14 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 
 	blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
 
+	if (blocksize < EXT2_MIN_BLOCK_SIZE ||
+	    blocksize > EXT2_MAX_BLOCK_SIZE) {
+		printk(KERN_ERR
+		       "EXT2-fs: Unsupported filesystem blocksize %d on %s.\n",
+		       blocksize, sb->s_id);
+		goto failed_mount;
+	}
+
 	if (ext2_use_xip(sb) && blocksize != PAGE_SIZE) {
 		if (!silent)
 			printk("XIP: Unsupported blocksize\n");
-- 
1.5.3.8





      reply	other threads:[~2009-02-12  6:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-10 22:57 + ext2-fix-support-for-empty-directory-blocks-in-64k-blocksize-filesystems.patch added to -mm tree akpm
2009-02-11 15:02 ` + ext2-fix-support-for-empty-directory-blocks-in-64k-blocksize-filesys tems.patch " Theodore Tso
2009-02-12  6:27   ` Wei Yongjun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4993C166.6020905@cn.fujitsu.com \
    --to=yjwei@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).