[PATCH 06/19] fuse2fs: check root directory while mounting

Darrick J. Wong
2025-11-06T22:32:41Z

The kernel will fail a mount attempt if the root directory inode isn't
even minimally readable at mount time. Do the same for fuse2fs so that
we can pass ext4/008.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
misc/fuse2fs.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 76872d793ea394..3e02eb13ec5488 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -4726,6 +4726,19 @@ static unsigned long long default_cache_size(void)
return ret;
}

+/* Make sure the root directory is readable. */
+static errcode_t fuse2fs_check_root_dir(ext2_filsys fs)
+{
+ struct ext2_inode_large inode;
+ errcode_t err;
+
+ err = fuse2fs_read_inode(fs, EXT2_ROOT_INO, &inode);
+ if (err)
+ return translate_error(fs, EXT2_ROOT_INO, err);
+
+ return 0;
+}
+
int main(int argc, char *argv[])
{
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
@@ -4978,6 +4991,10 @@ int main(int argc, char *argv[])
}
}

+ ret = fuse2fs_check_root_dir(global_fs);
+ if (ret)
+ goto out;
+
if (global_fs->flags & EXT2_FLAG_RW) {
if (ext2fs_has_feature_journal(global_fs->super))
log_printf(&fctx, "%s",