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>
_("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);