linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Jan Kara <jack@suse.com>, linux-ext4 <linux-ext4@vger.kernel.org>,
	Dave Chinner <david@fromorbit.com>, Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH] ext2: don't mount filesystems with compat features we know only ext4 supports
Date: Wed, 30 Sep 2015 10:41:26 +0200	[thread overview]
Message-ID: <20150930084126.GB16909@quack.suse.cz> (raw)
In-Reply-To: <20150928223626.GI10390@birch.djwong.org>

On Mon 28-09-15 15:36:26, Darrick J. Wong wrote:
> The ext2 mount code never checks the compat features against the ones
> it knows about.  This is correct behavior since compat features are
> supposed to be rw-compatible with old drivers; however, for certain
> configurations (journalled rootfs) we probably want the ext4 driver
> to load, not ext2.
> 
> Reported-by: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

Isn't this a bit too harsh? I agree we should at least warn (and that's
probably regardless of EXT4 config option) but just refusing mount looks
too much to me...

								Honza

> ---
>  fs/ext2/ext2.h  |    6 +++++-
>  fs/ext2/super.c |   13 ++++++++++---
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
> index 8d15feb..ce508b1 100644
> --- a/fs/ext2/ext2.h
> +++ b/fs/ext2/ext2.h
> @@ -547,7 +547,11 @@ struct ext2_super_block {
>  #define EXT2_FEATURE_INCOMPAT_META_BG		0x0010
>  #define EXT2_FEATURE_INCOMPAT_ANY		0xffffffff
>  
> -#define EXT2_FEATURE_COMPAT_SUPP	EXT2_FEATURE_COMPAT_EXT_ATTR
> +#define EXT2_FEATURE_COMPAT_SUPP	(EXT2_FEATURE_COMPAT_DIR_PREALLOC| \
> +					 EXT2_FEATURE_COMPAT_IMAGIC_INODES| \
> +					 EXT2_FEATURE_COMPAT_EXT_ATTR| \
> +					 EXT2_FEATURE_COMPAT_RESIZE_INO| \
> +					 EXT2_FEATURE_COMPAT_DIR_INDEX)
>  #define EXT2_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE| \
>  					 EXT2_FEATURE_INCOMPAT_META_BG)
>  #define EXT2_FEATURE_RO_COMPAT_SUPP	(EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \
> diff --git a/fs/ext2/super.c b/fs/ext2/super.c
> index 900e19c..4efb018 100644
> --- a/fs/ext2/super.c
> +++ b/fs/ext2/super.c
> @@ -896,6 +896,16 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
>  	 * previously didn't change the revision level when setting the flags,
>  	 * so there is a chance incompat flags are set on a rev 0 filesystem.
>  	 */
> +#ifdef CONFIG_EXT4_FS
> +	/* Journalled FS should mount with ext4 if it's available */
> +	features = EXT2_HAS_COMPAT_FEATURE(sb, ~EXT2_FEATURE_COMPAT_SUPP);
> +	if (features) {
> +		ext2_msg(sb, KERN_ERR,	"error: won't mount because of "
> +		       "unsupported optional features (%x); try ext4",
> +			le32_to_cpu(features));
> +		goto failed_mount;
> +	}
> +#endif
>  	features = EXT2_HAS_INCOMPAT_FEATURE(sb, ~EXT2_FEATURE_INCOMPAT_SUPP);
>  	if (features) {
>  		ext2_msg(sb, KERN_ERR,	"error: couldn't mount because of "
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2015-09-30  8:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28 22:36 [PATCH] ext2: don't mount filesystems with compat features we know only ext4 supports Darrick J. Wong
2015-09-30  8:41 ` Jan Kara [this message]
2015-09-30 16:36   ` Darrick J. Wong
2015-10-01  2:00     ` Dave Chinner
2015-10-07 13:29     ` Jan Kara
2015-10-08 18:08       ` Darrick J. Wong

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=20150930084126.GB16909@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=jack@suse.com \
    --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).