All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH 17/16] fuse2fs: recheck support after replaying journal
Date: Mon, 20 Oct 2025 13:26:17 -0700	[thread overview]
Message-ID: <20251020202617.GM6170@frogsfrogsfrogs> (raw)
In-Reply-To: <176062915393.3343688.9810444125172113159.stgit@frogsfrogsfrogs>

From: Darrick J. Wong <djwong@kernel.org>

The journal could have contained a new primary superblock, so we need to
recheck feature support after recovering it, because otherwise fuse2fs
could blow up on an unsupported feature that was enabled by a journal
transaction.

We also don't need to clear needsrecovery or dirty the superblock after
recovering the journal because ext2fs_run_ext3_journal does that for us.
Remove those lines.

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 |   60 ++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 36 insertions(+), 24 deletions(-)

diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index e33b09de08a11f..931e60f61e85b6 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -744,6 +744,36 @@ static int check_inum_access(struct fuse2fs *ff, ext2_ino_t ino, int mask)
 	return -EACCES;
 }
 
+static errcode_t fuse2fs_check_support(struct fuse2fs *ff)
+{
+	ext2_filsys fs = ff->fs;
+
+	if (ext2fs_has_feature_quota(fs->super)) {
+		err_printf(ff, "%s\n", _("quotas not supported."));
+		return EXT2_ET_UNSUPP_FEATURE;
+	}
+	if (ext2fs_has_feature_verity(fs->super)) {
+		err_printf(ff, "%s\n", _("verity not supported."));
+		return EXT2_ET_UNSUPP_FEATURE;
+	}
+	if (ext2fs_has_feature_encrypt(fs->super)) {
+		err_printf(ff, "%s\n", _("encryption not supported."));
+		return EXT2_ET_UNSUPP_FEATURE;
+	}
+	if (ext2fs_has_feature_casefold(fs->super)) {
+		err_printf(ff, "%s\n", _("casefolding not supported."));
+		return EXT2_ET_UNSUPP_FEATURE;
+	}
+
+	if (fs->super->s_state & EXT2_ERROR_FS) {
+		err_printf(ff, "%s\n",
+ _("Errors detected; running e2fsck is required."));
+		return EXT2_ET_FILESYSTEM_CORRUPTED;
+	}
+
+	return 0;
+}
+
 static void op_destroy(void *p EXT2FS_ATTR((unused)))
 {
 	struct fuse_context *ctxt = fuse_get_context();
@@ -4771,29 +4801,9 @@ int main(int argc, char *argv[])
 	}
 
 	ret = 3;
-
-	if (ext2fs_has_feature_quota(global_fs->super)) {
-		err_printf(&fctx, "%s", _("quotas not supported."));
+	err = fuse2fs_check_support(&fctx);
+	if (err)
 		goto out;
-	}
-	if (ext2fs_has_feature_verity(global_fs->super)) {
-		err_printf(&fctx, "%s", _("verity not supported."));
-		goto out;
-	}
-	if (ext2fs_has_feature_encrypt(global_fs->super)) {
-		err_printf(&fctx, "%s", _("encryption not supported."));
-		goto out;
-	}
-	if (ext2fs_has_feature_casefold(global_fs->super)) {
-		err_printf(&fctx, "%s", _("casefolding not supported."));
-		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,
@@ -4817,8 +4827,10 @@ int main(int argc, char *argv[])
 						_("Please run e2fsck -fy."));
 				goto out;
 			}
-			ext2fs_clear_feature_journal_needs_recovery(global_fs->super);
-			ext2fs_mark_super_dirty(global_fs);
+
+			err = fuse2fs_check_support(&fctx);
+			if (err)
+				goto out;
 		}
 	} else if (ext2fs_has_feature_journal(global_fs->super)) {
 		err = ext2fs_check_ext3_journal(global_fs);

  parent reply	other threads:[~2025-10-20 20:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-16 15:39 [PATCHSET] fuse2fs: round 6 bug fixes Darrick J. Wong
2025-10-16 15:40 ` [PATCH 01/16] debian/rules: remove extra pkg-config Darrick J. Wong
2025-10-16 15:40 ` [PATCH 02/16] libext2fs: use F_GETFL, not F_GETFD, in unixfd_open Darrick J. Wong
2025-10-16 15:40 ` [PATCH 03/16] libext2fs: don't look for O_EXCL in the F_GETFL output Darrick J. Wong
2025-10-16 15:40 ` [PATCH 04/16] libext2fs: fix ind_punch recursive block computation Darrick J. Wong
2025-10-16 15:41 ` [PATCH 05/16] libext2fs: the unixfd IO manager shouldn't close its fd Darrick J. Wong
2025-10-16 15:41 ` [PATCH 06/16] fuse2fs: update manpage Darrick J. Wong
2025-10-16 15:41 ` [PATCH 07/16] fuse2fs: quiet down EXT2_ET_RO_FILSYS errors Darrick J. Wong
2025-10-16 15:41 ` [PATCH 08/16] fuse2fs: free global_fs after a failed ext2fs_close call Darrick J. Wong
2025-10-16 15:42 ` [PATCH 09/16] fuse2fs: fix memory corruption when parsing mount options Darrick J. Wong
2025-10-16 15:42 ` [PATCH 10/16] fuse2fs: fix fssetxattr flags updates Darrick J. Wong
2025-10-16 15:42 ` [PATCH 11/16] fuse2fs: fix default acls propagating to non-dir children Darrick J. Wong
2025-10-16 15:42 ` [PATCH 12/16] fuse2fs: don't update atime when reading executable file content Darrick J. Wong
2025-10-16 15:43 ` [PATCH 13/16] fuse2fs: fix in_file_group missing the primary process gid Darrick J. Wong
2025-10-16 15:43 ` [PATCH 14/16] fuse2fs: work around EBUSY discard returns from dm-thinp Darrick J. Wong
2025-10-16 15:43 ` [PATCH 15/16] fuse2fs: check free space when creating a symlink Darrick J. Wong
2025-10-16 15:43 ` [PATCH 16/16] fuse2fs: spot check clean journals Darrick J. Wong
2025-10-20 20:26 ` Darrick J. Wong [this message]
2025-10-20 20:26 ` [PATCH 18/16] fuse2fs: make norecovery behavior consistent with the kernel Darrick J. Wong
2025-10-20 20:27 ` [PATCH 19/16] fuse2fs: mount norecovery if main block device is readonly Darrick J. Wong
2025-10-21 13:22 ` [PATCHSET] fuse2fs: round 6 bug fixes Theodore Tso

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=20251020202617.GM6170@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.