From: "Darrick J. Wong" <djwong@kernel.org>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 2/3] fuse2fs: make norecovery behavior consistent with the kernel
Date: Mon, 15 Sep 2025 17:02:42 -0700 [thread overview]
Message-ID: <175798064615.349841.5241149079975163420.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <175798064569.349841.5710112269701643406.stgit@frogsfrogsfrogs>
From: Darrick J. Wong <djwong@kernel.org>
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. Make the fuse2fs
option behave the same as the kernel.
Found via ext4/271.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
misc/fuse2fs.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index a84bd2245d82df..5917569c0a8d32 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -929,7 +929,8 @@ static void fuse2fs_unmount(struct fuse2fs *ff)
static errcode_t fuse2fs_open(struct fuse2fs *ff, int libext2_flags)
{
char options[128];
- int flags = EXT2_FLAG_64BITS | EXT2_FLAG_THREADS | libext2_flags;
+ int flags = EXT2_FLAG_64BITS | EXT2_FLAG_THREADS | EXT2_FLAG_RW |
+ libext2_flags;
errcode_t err;
if (ff->lockfile) {
@@ -940,8 +941,6 @@ static errcode_t fuse2fs_open(struct fuse2fs *ff, int libext2_flags)
snprintf(options, sizeof(options) - 1, "offset=%lu", ff->offset);
- if (!ff->norecovery)
- flags |= EXT2_FLAG_RW;
if (ff->directio)
flags |= EXT2_FLAG_DIRECT_IO;
@@ -1008,6 +1007,22 @@ static errcode_t fuse2fs_check_support(struct fuse2fs *ff)
return 0;
}
+static int fuse2fs_check_norecovery(struct fuse2fs *ff)
+{
+ if (ext2fs_has_feature_journal_needs_recovery(ff->fs->super) &&
+ !ff->ro) {
+ log_printf(ff, "%s\n",
+ _("Required journal recovery suppressed and not mounted read-only."));
+ return 32;
+ }
+
+ /*
+ * Amazingly, norecovery allows a rw mount when there's a clean journal
+ * present.
+ */
+ return 0;
+}
+
static int fuse2fs_mount(struct fuse2fs *ff)
{
struct ext2_inode_large inode;
@@ -5196,6 +5211,12 @@ int main(int argc, char *argv[])
if (ext2fs_has_feature_shared_blocks(fctx.fs->super))
fctx.ro = 1;
+ if (fctx.norecovery) {
+ ret = fuse2fs_check_norecovery(&fctx);
+ if (ret)
+ goto out;
+ }
+
err = fuse2fs_mount(&fctx);
if (err) {
ret = 32;
next prev parent reply other threads:[~2025-09-16 0:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 23:58 [PATCHSET 3/6] fuse2fs: refactor mount code Darrick J. Wong
2025-09-16 0:02 ` [PATCH 1/3] fuse2fs: split filesystem mounting into helper functions Darrick J. Wong
2025-09-16 0:02 ` Darrick J. Wong [this message]
2025-09-16 0:02 ` [PATCH 3/3] fuse2fs: recheck support after replaying journal Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=175798064615.349841.5241149079975163420.stgit@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox