[WIP] feat(fs): fuse support#1773
[WIP] feat(fs): fuse support#1773fslongjin wants to merge 20 commits intoDragonOS-Community:masterfrom
Conversation
- 新增FUSE权限控制机制,支持allow_other和default_permissions挂载选项 - 实现FUSE_DEV_IOC_CLONE设备克隆功能,支持多线程FUSE守护进程 - 添加FUSE_STATFS协议支持,完善文件系统统计信息 - 重构VFS权限检查,支持基于文件系统的权限策略(DAC/Remote) - 新增用户态测试程序,验证权限控制、设备克隆和统计功能 - 清理未使用的日志导入,优化代码结构 Signed-off-by: longjin <longjin@DragonOS.org>
- Introduced `FuseInitNegotiated` structure to manage negotiated parameters during FUSE initialization. - Implemented `on_umount` method to handle unmounting, ensuring in-flight requests are properly failed and queued for destruction. - Added `queue_forget` method to send FORGET messages for node lookups. - Enhanced read request handling to enforce minimum buffer size requirements. - Updated protocol definitions to include new FUSE opcodes and flags. - Removed obsolete `fuse_test_simplefs.h` header file. Signed-off-by: longjin <longjin@DragonOS.org>
- Added a detailed phased implementation plan for DragonOS FUSE, outlining key objectives and milestones from protocol enhancements to ecosystem compatibility. - Introduced a demo application (`fuse3_demo`) based on `libfuse3`, including automatic library download and build processes. - Implemented a test application (`test_fuse3_demo`) for regression testing of the FUSE functionality. - Enhanced FUSE connection management with new opcodes and improved request handling. - Updated protocol definitions to support additional FUSE operations and flags. Signed-off-by: longjin <longjin@DragonOS.org>
- 将FUSE私有数据相关结构体移至独立模块 - 统一使用枚举类型FuseFilePrivateData表示所有FUSE文件类型 - 简化代码结构,提高可维护性 Signed-off-by: longjin <longjin@DragonOS.org>
- Introduced `FuseRequestCred` struct to encapsulate user credentials for FUSE requests. - Refactored request building and handling methods to improve code clarity and reduce redundancy. - Updated `FuseDevPrivateData` to provide a safer way to obtain a reference to `FuseConn`. - Simplified connection reference retrieval in `LockedFuseDevInode` implementations. Signed-off-by: longjin <longjin@DragonOS.org>
- Added non-blocking and blocking methods for popping pending requests in `FuseConn`. - Introduced alignment for directory entry records in `FuseNode` to ensure proper memory alignment. - Implemented methods for parsing directory entries in `FuseNode`, improving the handling of readdir and readdirplus payloads. - Added a new script `run_all_test_fuse.sh` for executing and summarizing test results for FUSE applications. Signed-off-by: longjin <longjin@DragonOS.org>
…sing - Introduced a new `wait_with_recheck` function to streamline the waiting mechanism for requests in `FuseConn`, reducing code duplication. - Refactored the `wait_complete`, `wait_initialized`, and `pop_pending_blocking` methods to utilize the new waiting function. - Added utility methods in `FuseFS` for parsing optional integer and boolean values from strings, improving the clarity of mount option handling. Signed-off-by: longjin <longjin@DragonOS.org>
Signed-off-by: longjin <longjin@DragonOS.org>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7dd8a697e2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
kernel/src/filesystem/fuse/dev.rs
Outdated
| conn::FuseConn, | ||
| private_data::{FuseDevPrivateData, FuseFilePrivateData}, | ||
| }; | ||
| const FUSE_DEV_IOC_CLONE: u32 = 0x8004_4600; // _IOR('F', 0, uint32_t) |
There was a problem hiding this comment.
Use Linux ioctl number for FUSE_DEV_IOC_CLONE
FUSE_DEV_IOC_CLONE is defined here as 0x80044600, but Linux defines this ioctl as _IOR(229, 0, uint32_t) (0x8004e500). Userspace daemons built against standard <linux/fuse.h> will issue 0x8004e500, so this handler will return ENOTTY and break clone-based /dev/fuse workflows (notably multi-threaded daemons) despite otherwise valid FUSE setup.
Useful? React with 👍 / 👎.
kernel/src/filesystem/vfs/mount.rs
Outdated
| self.self_mountpoint.write().take(); | ||
|
|
||
| // Notify the filesystem that it has been unmounted. | ||
| self.inner_filesystem.on_umount(); |
There was a problem hiding this comment.
Call on_umount only after successful detach
on_umount() is invoked unconditionally even when do_umount() fails, so a failed unmount still notifies the underlying filesystem that teardown happened. For FUSE this can clear state/send DESTROY or abort the connection while the mount is still present, leaving an active mount backed by a torn-down connection.
Useful? React with 👍 / 👎.
kernel/src/filesystem/fuse/fs.rs
Outdated
| }; | ||
|
|
||
| conn.configure_mount(user_id, group_id, allow_other); | ||
| conn.mark_mounted()?; |
There was a problem hiding this comment.
Delay mark_mounted until mount setup fully succeeds
The connection is marked mounted before make_fs() sends FUSE_INIT. If enqueue_init() fails (for example, daemon fd already disconnected), mount returns an error but the connection remains marked as mounted, so retrying the same /dev/fuse fd later fails with EINVAL even though no mount ever succeeded.
Useful? React with 👍 / 👎.
Signed-off-by: longjin <longjin@DragonOS.org>
- Move peer group unregistration after successful mountpoint detachment - Ensure filesystem notifications only occur after successful umount - Simplify mountpoint removal logic in propagation functions Signed-off-by: longjin <longjin@DragonOS.org>
- Add`rollback_mount_setup`method to revert mount state on failure - Move`mark_mounted`and`configure_mount`calls to`mount`method - Propagate`allow_other`flag via`FuseMountData` - Handle`enqueue_init`errors by rolling back mount setup Signed-off-by: longjin <longjin@DragonOS.org>
No description provided.