[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176062915755.3343688.6287848560218999608.stgit@frogsfrogsfrogs>
Date: Thu, 16 Oct 2025 08:43:58 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: [PATCH 16/16] fuse2fs: spot check clean journals
From: Darrick J. Wong <djwong@...nel.org>
Even though fuse2fs doesn't (yet) support writing new transactions to
the journal, we ought at least to check that the superblock is ok when
we mount a clean filesystem. This fixes complaints by ext4/012 about
mount failing to notice a corrupt journal.
Cc: <linux-ext4@...r.kernel.org> # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
debugfs/journal.h | 2 ++
debugfs/journal.c | 2 +-
misc/fuse2fs.c | 7 +++++++
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/debugfs/journal.h b/debugfs/journal.h
index 10b638ebaab5db..67b8c99828bb0d 100644
--- a/debugfs/journal.h
+++ b/debugfs/journal.h
@@ -18,6 +18,8 @@
errcode_t ext2fs_open_journal(ext2_filsys fs, journal_t **j);
errcode_t ext2fs_close_journal(ext2_filsys fs, journal_t **j);
errcode_t ext2fs_run_ext3_journal(ext2_filsys *fs);
+errcode_t ext2fs_check_ext3_journal(ext2_filsys fs);
+
void jbd2_commit_block_csum_set(journal_t *j, struct buffer_head *bh);
void jbd2_revoke_csum_set(journal_t *j, struct buffer_head *bh);
void jbd2_descr_block_csum_set(journal_t *j, struct buffer_head *bh);
diff --git a/debugfs/journal.c b/debugfs/journal.c
index a6d8d4c5adf9cf..f79abcccf6adea 100644
--- a/debugfs/journal.c
+++ b/debugfs/journal.c
@@ -681,7 +681,7 @@ static void ext2fs_journal_release(ext2_filsys fs, journal_t *journal,
* This function makes sure that the superblock fields regarding the
* journal are consistent.
*/
-static errcode_t ext2fs_check_ext3_journal(ext2_filsys fs)
+errcode_t ext2fs_check_ext3_journal(ext2_filsys fs)
{
struct ext2_super_block *sb = fs->super;
journal_t *journal;
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 210807ea493f51..e33b09de08a11f 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -192,6 +192,7 @@ static inline uint64_t round_down(uint64_t b, unsigned int align)
# define FL_ZERO_RANGE_FLAG (0)
#endif
+errcode_t ext2fs_check_ext3_journal(ext2_filsys fs);
errcode_t ext2fs_run_ext3_journal(ext2_filsys *fs);
#ifdef CONFIG_JBD_DEBUG /* Enabled by configure --enable-jbd-debug */
@@ -4819,6 +4820,12 @@ int main(int argc, char *argv[])
ext2fs_clear_feature_journal_needs_recovery(global_fs->super);
ext2fs_mark_super_dirty(global_fs);
}
+ } else if (ext2fs_has_feature_journal(global_fs->super)) {
+ err = ext2fs_check_ext3_journal(global_fs);
+ if (err) {
+ translate_error(global_fs, 0, err);
+ goto out;
+ }
}
if (global_fs->flags & EXT2_FLAG_RW) {
Powered by blists - more mailing lists