From 5aba0ce6aa6f586e8bbd698a8e9fbe1644bebb48 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Tue, 8 Jul 2025 16:04:35 -0700 Subject: [PATCH] fuse2fs: check for recorded fs errors before touching things Refuse the mount if there are errors recorded in the superblock. We should not be trying to replay the journal on damaged filesystems. Cc: # v1.43 Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs") Signed-off-by: "Darrick J. Wong" --- misc/fuse2fs.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index c201f95e..415f1748 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -4723,6 +4723,12 @@ int main(int argc, char *argv[]) goto out; } + if (global_fs->super->s_state & EXT2_ERROR_FS) { + err_printf(&fctx, "%s\n", + _("Errors detected; running e2fsck is required.")); + goto out; + } + /* * ext4 can't do COW of shared blocks, so if the feature is enabled, * we must force ro mode. @@ -4784,12 +4790,6 @@ int main(int argc, char *argv[]) err_printf(&fctx, "%s\n", _("Orphans detected; running e2fsck is recommended.")); - if (global_fs->super->s_state & EXT2_ERROR_FS) { - err_printf(&fctx, "%s\n", - _("Errors detected; running e2fsck is required.")); - goto out; - } - /* Clear the valid flag so that an unclean shutdown forces a fsck */ if (global_fs->flags & EXT2_FLAG_RW) { global_fs->super->s_mnt_count++; -- 2.47.3