summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYe Bin <yebin10@huawei.com>2024-09-30 08:59:42 +0800
committerTheodore Ts'o <tytso@mit.edu>2024-11-12 23:54:14 -0500
commit22d26f9b0c3ee2ef75daf2feee8f0a9eac385939 (patch)
treeeefa3876ce6a0f73021a9711f3565ebdea52b8c4
parent0f67827bf44fdf2a4426cc918ee8cfc1274f8efa (diff)
downloadlinux-stable-22d26f9b0c3ee2ef75daf2feee8f0a9eac385939.tar.gz
linux-stable-22d26f9b0c3ee2ef75daf2feee8f0a9eac385939.tar.bz2
linux-stable-22d26f9b0c3ee2ef75daf2feee8f0a9eac385939.zip
jbd2: remove the 'success' parameter from the jbd2_do_replay() function
Keep 'success' internally to track if any error happened and then return it at the end in do_one_pass(). If jbd2_do_replay() return -ENOMEM then stop replay journal. Signed-off-by: Ye Bin <yebin10@huawei.com> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20240930005942.626942-7-yebin@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/jbd2/recovery.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index 4f1e9ca34503..9192be7c19d8 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -489,12 +489,11 @@ static __always_inline int jbd2_do_replay(journal_t *journal,
struct recovery_info *info,
struct buffer_head *bh,
unsigned long *next_log_block,
- unsigned int next_commit_ID,
- int *success)
+ unsigned int next_commit_ID)
{
char *tagp;
int flags;
- int err;
+ int ret = 0;
int tag_bytes = journal_tag_bytes(journal);
int descr_csum_size = 0;
unsigned long io_block;
@@ -508,6 +507,7 @@ static __always_inline int jbd2_do_replay(journal_t *journal,
tagp = &bh->b_data[sizeof(journal_header_t)];
while (tagp - bh->b_data + tag_bytes <=
journal->j_blocksize - descr_csum_size) {
+ int err;
memcpy(&tag, tagp, sizeof(tag));
flags = be16_to_cpu(tag.t_flags);
@@ -517,7 +517,7 @@ static __always_inline int jbd2_do_replay(journal_t *journal,
err = jread(&obh, journal, io_block);
if (err) {
/* Recover what we can, but report failure at the end. */
- *success = err;
+ ret = err;
pr_err("JBD2: IO error %d recovering block %lu in log\n",
err, io_block);
} else {
@@ -539,7 +539,7 @@ static __always_inline int jbd2_do_replay(journal_t *journal,
(journal_block_tag3_t *)tagp,
obh->b_data, next_commit_ID)) {
brelse(obh);
- *success = -EFSBADCRC;
+ ret = -EFSBADCRC;
pr_err("JBD2: Invalid checksum recovering data block %llu in journal block %lu\n",
blocknr, io_block);
goto skip_write;
@@ -580,7 +580,7 @@ skip_write:
break;
}
- return 0;
+ return ret;
}
static int do_one_pass(journal_t *journal,
@@ -719,9 +719,12 @@ static int do_one_pass(journal_t *journal,
* done here!
*/
err = jbd2_do_replay(journal, info, bh, &next_log_block,
- next_commit_ID, &success);
- if (err)
- goto failed;
+ next_commit_ID);
+ if (err) {
+ if (err == -ENOMEM)
+ goto failed;
+ success = err;
+ }
continue;