lkml.org 
[lkml]   [2023]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 3/6] jbd2: do extra handle when do journal recovery
Date
From: Ye Bin <yebin10@huawei.com>

Ext4 file system's super block in journal maybe not uptodate, when
file system has error, we need set error information when do recover
uper block.

Signed-off-by: Ye Bin <yebin10@huawei.com>
---
fs/jbd2/recovery.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index 8286a9ec122f..83b1a9689984 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -309,6 +309,15 @@ int jbd2_journal_recover(journal_t *journal)
return 0;
}

+ if (journal->j_replay_prepare_callback) {
+ err = journal->j_replay_prepare_callback(journal);
+ if (err) {
+ jbd2_debug(1, "JBD2: failed to prepare replay %d",
+ err);
+ return err;
+ }
+ }
+
err = do_one_pass(journal, &info, PASS_SCAN);
if (!err)
err = do_one_pass(journal, &info, PASS_REVOKE);
@@ -335,6 +344,10 @@ int jbd2_journal_recover(journal_t *journal)
if (!err)
err = err2;
}
+
+ if (journal->j_replay_end_callback)
+ journal->j_replay_end_callback(journal);
+
return err;
}

@@ -687,6 +700,20 @@ static int do_one_pass(journal_t *journal,
*((__be32 *)nbh->b_data) =
cpu_to_be32(JBD2_MAGIC_NUMBER);
}
+ if (unlikely(journal->j_replay_callback)) {
+ err = journal->j_replay_callback(
+ journal, nbh);
+ if (err) {
+ printk(KERN_ERR
+ "JBD2: replay "
+ "call back "
+ "failed.\n");
+ unlock_buffer(nbh);
+ brelse(obh);
+ brelse(nbh);
+ goto failed;
+ }
+ }

BUFFER_TRACE(nbh, "marking dirty");
set_buffer_uptodate(nbh);
--
2.31.1
\
 
 \ /
  Last update: 2023-03-27 00:17    [W:0.140 / U:0.828 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site