public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: correct inconsistent error msg in nojournal mode
@ 2022-11-09  7:43 Baokun Li
  2022-11-09 11:29 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Baokun Li @ 2022-11-09  7:43 UTC (permalink / raw)
  To: linux-ext4
  Cc: tytso, adilger.kernel, jack, ritesh.list, linux-kernel, yi.zhang,
	yukuai3, libaokun1

When we used the journal_async_commit mounting option in nojournal mode,
the kernel told me that "can't mount with journal_checksum", was very
confusing. I find that when we mount with journal_async_commit, both the
JOURNAL_ASYNC_COMMIT and EXPLICIT_JOURNAL_CHECKSUM flags are set. However,
in the error branch, CHECKSUM is checked before ASYNC_COMMIT. As a result,
the above inconsistency occurs, and the ASYNC_COMMIT branch becomes dead
code that cannot be executed. Therefore, we exchange the positions of the
two judgments to make the error msg more accurate.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 fs/ext4/super.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 63ef74eb8091..e4ababd0f132 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5286,14 +5286,15 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
 		goto failed_mount3a;
 	} else {
 		/* Nojournal mode, all journal mount options are illegal */
-		if (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {
+		if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
 			ext4_msg(sb, KERN_ERR, "can't mount with "
-				 "journal_checksum, fs mounted w/o journal");
+				 "journal_async_commit, fs mounted w/o journal");
 			goto failed_mount3a;
 		}
-		if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
+
+		if (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {
 			ext4_msg(sb, KERN_ERR, "can't mount with "
-				 "journal_async_commit, fs mounted w/o journal");
+				 "journal_checksum, fs mounted w/o journal");
 			goto failed_mount3a;
 		}
 		if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: correct inconsistent error msg in nojournal mode
  2022-11-09  7:43 [PATCH] ext4: correct inconsistent error msg in nojournal mode Baokun Li
@ 2022-11-09 11:29 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2022-11-09 11:29 UTC (permalink / raw)
  To: Baokun Li
  Cc: linux-ext4, tytso, adilger.kernel, jack, ritesh.list,
	linux-kernel, yi.zhang, yukuai3

On Wed 09-11-22 15:43:43, Baokun Li wrote:
> When we used the journal_async_commit mounting option in nojournal mode,
> the kernel told me that "can't mount with journal_checksum", was very
> confusing. I find that when we mount with journal_async_commit, both the
> JOURNAL_ASYNC_COMMIT and EXPLICIT_JOURNAL_CHECKSUM flags are set. However,
> in the error branch, CHECKSUM is checked before ASYNC_COMMIT. As a result,
> the above inconsistency occurs, and the ASYNC_COMMIT branch becomes dead
> code that cannot be executed. Therefore, we exchange the positions of the
> two judgments to make the error msg more accurate.
> 
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

Yeah, this is probably more consistent error message. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/super.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 63ef74eb8091..e4ababd0f132 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -5286,14 +5286,15 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
>  		goto failed_mount3a;
>  	} else {
>  		/* Nojournal mode, all journal mount options are illegal */
> -		if (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {
> +		if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
>  			ext4_msg(sb, KERN_ERR, "can't mount with "
> -				 "journal_checksum, fs mounted w/o journal");
> +				 "journal_async_commit, fs mounted w/o journal");
>  			goto failed_mount3a;
>  		}
> -		if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
> +
> +		if (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {
>  			ext4_msg(sb, KERN_ERR, "can't mount with "
> -				 "journal_async_commit, fs mounted w/o journal");
> +				 "journal_checksum, fs mounted w/o journal");
>  			goto failed_mount3a;
>  		}
>  		if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-09 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-09  7:43 [PATCH] ext4: correct inconsistent error msg in nojournal mode Baokun Li
2022-11-09 11:29 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox