diff mbox

[03/25] mke2fs: don't let resize= turn on resize_inode when meta_bg is set

Message ID 20131018044915.7339.15471.stgit@birch.djwong.org
State Superseded, archived
Headers show

Commit Message

Darrick Wong Oct. 18, 2013, 4:49 a.m. UTC
Passing the "-E resize=NNN" option to mke2fs sets the resize_inode
feature.  However, resize_inode and meta_bg are mutually exclusive
(and the feature flag parser enforces this); therefore, we shouldn't
allow resize_inode to sneak in the back door like this.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 misc/mke2fs.c |   11 +++++++++++
 1 file changed, 11 insertions(+)



--
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

Comments

Lukas Czerner Oct. 23, 2013, 3:08 p.m. UTC | #1
On Thu, 17 Oct 2013, Darrick J. Wong wrote:

> Date: Thu, 17 Oct 2013 21:49:16 -0700
> From: Darrick J. Wong <darrick.wong@oracle.com>
> To: tytso@mit.edu, darrick.wong@oracle.com
> Cc: linux-ext4@vger.kernel.org
> Subject: [PATCH 03/25] mke2fs: don't let resize= turn on resize_inode when
>     meta_bg is set
> 
> Passing the "-E resize=NNN" option to mke2fs sets the resize_inode
> feature.  However, resize_inode and meta_bg are mutually exclusive
> (and the feature flag parser enforces this); therefore, we shouldn't
> allow resize_inode to sneak in the back door like this.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  misc/mke2fs.c |   11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> 
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index 6e709b9..ce3c696 100644
> --- a/misc/mke2fs.c
> +++ b/misc/mke2fs.c
> @@ -2448,6 +2448,17 @@ int main (int argc, char *argv[])
>  	}
>  	fs->progress_ops = &ext2fs_numeric_progress_ops;
>  
> +	/* We can't have resize_inode sneak in via resize= on a meta_bg fs. */
> +	if (!quiet &&

It means that this will only be checked when user does _not_ run
with quiet mode, so it'll still be possible when run with -q. I
assume this is not what you wanted.

Thanks!
-Lukas


> +	    EXT2_HAS_INCOMPAT_FEATURE(fs->super,
> +				      EXT2_FEATURE_INCOMPAT_META_BG) &&
> +	    fs->super->s_reserved_gdt_blocks > 0) {
> +		printf(_("Reserving GDT blocks (resize_inode) is not possible "
> +			 "with the meta_bg feature.\nThey cannot be enabled "
> +			 "simultaneously.\n"));
> +		exit(1);
> +	}
> +
>  	/* Check the user's mkfs options for metadata checksumming */
>  	if (!quiet &&
>  	    EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
> 
> --
> 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
> 
--
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
diff mbox

Patch

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 6e709b9..ce3c696 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2448,6 +2448,17 @@  int main (int argc, char *argv[])
 	}
 	fs->progress_ops = &ext2fs_numeric_progress_ops;
 
+	/* We can't have resize_inode sneak in via resize= on a meta_bg fs. */
+	if (!quiet &&
+	    EXT2_HAS_INCOMPAT_FEATURE(fs->super,
+				      EXT2_FEATURE_INCOMPAT_META_BG) &&
+	    fs->super->s_reserved_gdt_blocks > 0) {
+		printf(_("Reserving GDT blocks (resize_inode) is not possible "
+			 "with the meta_bg feature.\nThey cannot be enabled "
+			 "simultaneously.\n"));
+		exit(1);
+	}
+
 	/* Check the user's mkfs options for metadata checksumming */
 	if (!quiet &&
 	    EXT2_HAS_RO_COMPAT_FEATURE(fs->super,