]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
fuse2fs: make norecovery behavior consistent with the kernel
authorDarrick J. Wong <djwong@kernel.org>
Thu, 28 Aug 2025 17:30:43 +0000 (10:30 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 17 Oct 2025 23:34:22 +0000 (16:34 -0700)
Amazingly, norecovery/noload on the kernel ext4 driver allows a
read-write mount even for journalled filesystems.  The one case where
mounting fails is if there's a journal and it's dirty AND you didn't
specify norecovery.  Make the fuse2fs option behave the same as the
kernel.

Also, ext2fs_run_ext3_journal doesn't explicitly check EXT2_FILE_RW
state, which means fuse2fs must do that.

Found via ext4/271.

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 931e60f61e85b6c03ce0543065c1373b09177279..9922747728a438b65397cfbdf13f3c2150b52e5e 100644 (file)
@@ -4818,6 +4818,11 @@ int main(int argc, char *argv[])
  _("Mounting read-only without recovering journal."));
                        fctx.ro = 1;
                        global_fs->flags &= ~EXT2_FLAG_RW;
+               } else if (!(global_fs->flags & EXT2_FLAG_RW)) {
+                       err_printf(&fctx, "%s\n",
+ _("Cannot replay journal on read-only device."));
+                       ret = 32;
+                       goto out;
                } else {
                        log_printf(&fctx, "%s\n", _("Recovering journal."));
                        err = ext2fs_run_ext3_journal(&global_fs);