diff mbox series

[1/2] mke2fs: Warn if page size != blocksize when ecnrypt is enabled

Message ID 20190821131813.9456-1-lczerner@redhat.com
State New
Headers show
Series [1/2] mke2fs: Warn if page size != blocksize when ecnrypt is enabled | expand

Commit Message

Lukas Czerner Aug. 21, 2019, 1:18 p.m. UTC
With encrypt feature enabled the file system block size must match
system page size. Currently mke2fs will not complain at all when we try
to create a file system that does not satisfy this requirement for the
system. Add a warning for this case.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
 misc/mke2fs.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Eric Sandeen Aug. 21, 2019, 3:19 p.m. UTC | #1
On 8/21/19 8:18 AM, Lukas Czerner wrote:
> With encrypt feature enabled the file system block size must match
> system page size. Currently mke2fs will not complain at all when we try
> to create a file system that does not satisfy this requirement for the
> system. Add a warning for this case.
> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>

This matches the warnings we give for block size > system page size, for example,
so this makes sense to me.

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

> ---
>  misc/mke2fs.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index d7cf257e..aa9590d8 100644
> --- a/misc/mke2fs.c
> +++ b/misc/mke2fs.c
> @@ -2468,6 +2468,26 @@ profile_error:
>  		      exit (1);
>  	}
>  
> +	/*
> +	 * Encrypt feature requires blocksize to be the same as page size,
> +	 * otherwise file system won't mount
> +	 */
> +	if (ext2fs_has_feature_encrypt(&fs_param) &&
> +	   (blocksize != sys_page_size)) {
> +		if (!force) {
> +			com_err(program_name, 0,
> +				_("Encrypt feature is enabled, but block size "
> +				  "(%dB) does not match system page size "
> +				  "(%dB)"),
> +				blocksize, sys_page_size);
> +			proceed_question(proceed_delay);
> +		}
> +		fprintf(stderr,_("Warning: Encrypt feature enabled, but block "
> +				 "size (%dB) does not match system page size "
> +				 "(%dB), forced to continue\n"),
> +			blocksize, sys_page_size);
> +	}
> +
>  	/* Don't allow user to set both metadata_csum and uninit_bg bits. */
>  	if (ext2fs_has_feature_metadata_csum(&fs_param) &&
>  	    ext2fs_has_feature_gdt_csum(&fs_param))
>
Lukas Czerner Oct. 3, 2019, 12:51 p.m. UTC | #2
ping

On Wed, Aug 21, 2019 at 03:18:12PM +0200, Lukas Czerner wrote:
> With encrypt feature enabled the file system block size must match
> system page size. Currently mke2fs will not complain at all when we try
> to create a file system that does not satisfy this requirement for the
> system. Add a warning for this case.
> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> ---
>  misc/mke2fs.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index d7cf257e..aa9590d8 100644
> --- a/misc/mke2fs.c
> +++ b/misc/mke2fs.c
> @@ -2468,6 +2468,26 @@ profile_error:
>  		      exit (1);
>  	}
>  
> +	/*
> +	 * Encrypt feature requires blocksize to be the same as page size,
> +	 * otherwise file system won't mount
> +	 */
> +	if (ext2fs_has_feature_encrypt(&fs_param) &&
> +	   (blocksize != sys_page_size)) {
> +		if (!force) {
> +			com_err(program_name, 0,
> +				_("Encrypt feature is enabled, but block size "
> +				  "(%dB) does not match system page size "
> +				  "(%dB)"),
> +				blocksize, sys_page_size);
> +			proceed_question(proceed_delay);
> +		}
> +		fprintf(stderr,_("Warning: Encrypt feature enabled, but block "
> +				 "size (%dB) does not match system page size "
> +				 "(%dB), forced to continue\n"),
> +			blocksize, sys_page_size);
> +	}
> +
>  	/* Don't allow user to set both metadata_csum and uninit_bg bits. */
>  	if (ext2fs_has_feature_metadata_csum(&fs_param) &&
>  	    ext2fs_has_feature_gdt_csum(&fs_param))
> -- 
> 2.21.0
>
diff mbox series

Patch

diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index d7cf257e..aa9590d8 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -2468,6 +2468,26 @@  profile_error:
 		      exit (1);
 	}
 
+	/*
+	 * Encrypt feature requires blocksize to be the same as page size,
+	 * otherwise file system won't mount
+	 */
+	if (ext2fs_has_feature_encrypt(&fs_param) &&
+	   (blocksize != sys_page_size)) {
+		if (!force) {
+			com_err(program_name, 0,
+				_("Encrypt feature is enabled, but block size "
+				  "(%dB) does not match system page size "
+				  "(%dB)"),
+				blocksize, sys_page_size);
+			proceed_question(proceed_delay);
+		}
+		fprintf(stderr,_("Warning: Encrypt feature enabled, but block "
+				 "size (%dB) does not match system page size "
+				 "(%dB), forced to continue\n"),
+			blocksize, sys_page_size);
+	}
+
 	/* Don't allow user to set both metadata_csum and uninit_bg bits. */
 	if (ext2fs_has_feature_metadata_csum(&fs_param) &&
 	    ext2fs_has_feature_gdt_csum(&fs_param))