feat(filesystem): 实现 pivot_root 系统调用#1766
feat(filesystem): 实现 pivot_root 系统调用#1766sparkzky wants to merge 3 commits intoDragonOS-Community:masterfrom
Conversation
实现完整的 pivot_root(2) 系统调用,支持容器根文件系统切换。 主要功能: - 新增 sys_pivot_root.rs,实现 Linux 兼容的 pivot_root 语义 - MountFS 增加 bind_target_root 支持,正确处理 bind mount 场景 - 挂载命名空间增加旧根挂载点管理,支持 pivot_root 后卸载 - umount2 增加对当前目录卸载的特殊处理 Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
|
@claude review |
|
Claude finished @sparkzky's task in 7m 1s —— View job PR Review: pivot_root system call implementationI've completed my review of the PR implementing the Todo List:
Overall AssessmentThis is a well-implemented feature that adds Linux-compatible Strengths
Issues and Recommendations1. Code Duplication -
|
- 消除代码重复:使用 utils::is_ancestor_limited() 替代
sys_pivot_root.rs 中的本地实现
- 简化 get_mountfs():提取 find_bind_mount() 辅助函数
- 为 unsafe 操作添加详细的安全文档:
MountFS::set_mount_flags() 和 MntNamespace::force_change_root_mountfs()
- 更新 is_ancestor():同时检查文件系统指针和 inode ID
- 导出 MAX_ANCESTOR_TRAVERSAL_DEPTH 常量以供复用
Signed-off-by: sparkzky <sparkhhhhhhhhhh@outlook.com>
|
@claude review |
|
I'll analyze this and get back to you. |

实现完整的 pivot_root(2) 系统调用,支持容器根文件系统切换。
主要功能: