Skip to content

Conversation

Copy link

Copilot AI commented Dec 4, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

任务:本地 main 分支后面创建分支 bind-kernel-new,并完成以下功能:

[标题] 在 libfuse-fs::passthroughfs 中支持 bind mount,以支持容器的卷管理

[任务] 在现有 libfuse-fs 的 passthroughfs 中增加对 bind mount 的支持,实现用户态路径挂载到 overlay merged 层的功能,不依赖内核 mount 特权,同时 overlayfs 可继续依赖 passthroughfs 使用该功能。

[任务分值] 70 分

[背景描述] 容器场景中,常需要将宿主目录挂载到 overlay merged 层。传统 bind mount 依赖内核权限(CAP_SYS_ADMIN),在 rootless 容器中无法直接使用。 为了增强 libfuse-fs 的灵活性和兼容性,需要在 passthroughfs 用户态层实现 bind mount 功能,使容器可以访问宿主路径而不依赖内核 mount,同时 overlayfs 依赖 passthroughfs 的逻辑可以自然使用该 bind mount 功能。

[需求描述]

在 passthroughfs 中支持用户态 bind mount,实现 merged 路径映射到宿主路径。
在 FUSE lookup / open / read / write 等回调中处理 bind mount 路径请求。
目录遍历(readdir)在 bind mount 路径下正确显示宿主目录内容。
可选择只读或可写模式,写入宿主路径时支持直接写入。
避免路径冲突、循环挂载,确保 overlay 上下文语义正确。
保证性能和安全性,遵循 rootless 用户权限限制。
overlayfs 可以继续依赖 passthroughfs,通过 bind mount 访问宿主路径。

==由于时间紧张,直接依赖内核 bind mount 功能==
==由于时间紧张,直接依赖内核 bind mount 功能==
==由于时间紧张,直接依赖内核 bind mount 功能==

期望效果

你运行下面的!

  • 通过集成测试
    参考 4da0a8a 下的
    project/libfuse-fs/tests/bind_passthrough_test.sh
    project/libfuse-fs/tests/bind_overlay_test.sh
  • 运行崩溃 panic 要取消 bind 挂载
  • 成功运行
BINARY="/root/rk8s/project/target/debug/examples/overlayfs_example"

sudo "$BINARY" \
    --mountpoint /root/merged \
    --upperdir /root/upper \
    --lowerdir /root/ubuntu-rootfs \
    --bind "proc:/proc" \
    --bind "sys:/sys" \
    --bind "dev:/dev" \
    --bind "dev/pts:/dev/pts" \
    --bind "etc/resolv.conf:/etc/resolv.conf" \
    --privileged

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants