Commit 1d401650 authored by Guoqing Cai's avatar Guoqing Cai Committed by Theodore Ts'o

fs: jbd2: fix an incorrect warn log

In jbd2_journal_load(), when journal_reset fails, it prints an incorrect
warn log.

Fix this by changing the goto statement to return statement.

Also, return actual error code from jbd2_journal_recover() and journal_reset().
Signed-off-by: default avatarGuoqing Cai <u202112087@hust.edu.cn>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230413095740.2222066-1-u202112087@hust.edu.cnSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent bedc5d34
...@@ -2089,8 +2089,11 @@ int jbd2_journal_load(journal_t *journal) ...@@ -2089,8 +2089,11 @@ int jbd2_journal_load(journal_t *journal)
/* Let the recovery code check whether it needs to recover any /* Let the recovery code check whether it needs to recover any
* data from the journal. */ * data from the journal. */
if (jbd2_journal_recover(journal)) err = jbd2_journal_recover(journal);
goto recovery_error; if (err) {
pr_warn("JBD2: journal recovery failed\n");
return err;
}
if (journal->j_failed_commit) { if (journal->j_failed_commit) {
printk(KERN_ERR "JBD2: journal transaction %u on %s " printk(KERN_ERR "JBD2: journal transaction %u on %s "
...@@ -2107,15 +2110,14 @@ int jbd2_journal_load(journal_t *journal) ...@@ -2107,15 +2110,14 @@ int jbd2_journal_load(journal_t *journal)
/* OK, we've finished with the dynamic journal bits: /* OK, we've finished with the dynamic journal bits:
* reinitialise the dynamic contents of the superblock in memory * reinitialise the dynamic contents of the superblock in memory
* and reset them on disk. */ * and reset them on disk. */
if (journal_reset(journal)) err = journal_reset(journal);
goto recovery_error; if (err) {
pr_warn("JBD2: journal reset failed\n");
return err;
}
journal->j_flags |= JBD2_LOADED; journal->j_flags |= JBD2_LOADED;
return 0; return 0;
recovery_error:
printk(KERN_WARNING "JBD2: recovery failed\n");
return -EIO;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment