]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
fuse2fs: disable write access when cluster size > block size
authorDarrick J. Wong <djwong@kernel.org>
Wed, 28 Jan 2026 18:00:23 +0000 (10:00 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 9 Mar 2026 02:14:03 +0000 (19:14 -0700)
The libext2fs punch functions do not handle cluster deallocation
correctly when the bigalloc cluster size is larger than a single
fsblock.  To avoid trashing these filesystems until we can fix it, mount
the filesystem in readonly mode.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
misc/fuse2fs.c

index 76872d793ea39483cf9a4f48dc2de4e2a31d54e5..69e1f7d3bc393b8fb910532f38c78c030512a5c1 100644 (file)
@@ -4945,6 +4945,17 @@ int main(int argc, char *argv[])
        if (ext2fs_has_feature_shared_blocks(global_fs->super))
                fctx.ro = 1;
 
+       /*
+        * libext2fs' extent tree modification code has severe problems with
+        * implied cluster deallocation, so we must force ro mode.
+        */
+       if (ext2fs_has_feature_bigalloc(global_fs->super) &&
+           EXT2FS_CLUSTER_RATIO(global_fs) > 1) {
+               log_printf(&fctx, "%s\n",
+ _("Mounting read-only because writes with large cluster sizes is not supported."));
+               fctx.ro = 1;
+       }
+
        if (ext2fs_has_feature_journal_needs_recovery(global_fs->super)) {
                if (fctx.norecovery) {
                        log_printf(&fctx, "%s\n",