Skip to content

Commit 1872549

Browse files
LiBaokun96gregkh
authored andcommitted
ext4: correct inconsistent error msg in nojournal mode
[ Upstream commit 89481b5 ] 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> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20221109074343.4184862-1-libaokun1@huawei.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 761f88f commit 1872549

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

fs/ext4/super.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4667,14 +4667,15 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
46674667
goto failed_mount3a;
46684668
} else {
46694669
/* Nojournal mode, all journal mount options are illegal */
4670-
if (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {
4670+
if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
46714671
ext4_msg(sb, KERN_ERR, "can't mount with "
4672-
"journal_checksum, fs mounted w/o journal");
4672+
"journal_async_commit, fs mounted w/o journal");
46734673
goto failed_mount3a;
46744674
}
4675-
if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
4675+
4676+
if (test_opt2(sb, EXPLICIT_JOURNAL_CHECKSUM)) {
46764677
ext4_msg(sb, KERN_ERR, "can't mount with "
4677-
"journal_async_commit, fs mounted w/o journal");
4678+
"journal_checksum, fs mounted w/o journal");
46784679
goto failed_mount3a;
46794680
}
46804681
if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) {

0 commit comments

Comments
 (0)