]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
fuse2fs: check for recorded fs errors before touching things
authorDarrick J. Wong <djwong@kernel.org>
Tue, 8 Jul 2025 23:04:35 +0000 (16:04 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 21 Aug 2025 00:00:54 +0000 (17:00 -0700)
Refuse the mount if there are errors recorded in the superblock.  We
should not be trying to replay the journal on damaged filesystems.

Cc: <linux-ext4@vger.kernel.org> # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
misc/fuse2fs.c

index c201f95e771b8580142aa2861cdffa3be708755e..415f174875922fefe309dfa12d53172245622bce 100644 (file)
@@ -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++;