Repository navigation
fix(disk): 整理竞争及时报忙并让磁盘信息安全降级 - #63
Merged
Merged
Conversation
This was referenced Nov 5, 2026
Closed
Merged
This was referenced Nov 5, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs ModAVD/ModAVD#95
本 PR 完成三个子项:
compact 先取得实例的 disk 排他锁,再按原顺序取得 start/stop/bridge/create,逆序释放。其它操作在取锁前、失败后以及等待重试时探测 disk。探针使用共享字节锁,彼此不会误报整理;compact 最多等待 100 ms 让短探针结束,其余生命周期锁仍不等待。使用系统锁判断所有权,空锁文件或进程异常结束不会留下永久 busy。
info 没有取得 start 锁就不运行 qemu-img。可读取的大小保留,不可读的数值省略并附 warnings;on_disk_bytes 正常情况下仍是原来的 JSON 数字,只在不可读时省略。CLI、GUI 和 MCP 已适配。GUI 显示诊断原因,不再把 needs_shutdown 一律解释成正在开机。info 只检查文件头、宿主占用,以及有锁的离线 qcow2 元数据,不修复镜像,也不检查客体文件系统。
基于提交前重新抓取的 upstream/main
dc6501a,分支fix/95-disk-busy-info。没有拉取、下载或同步 AOSP。没有改动 compact 的超时、收益判断或结果报告。验证:
node --test scripts/test_disk_info.mjs两项通过。兼容性:
705497a、更新换包等待关机辅助进程并阻断并发 SDK 启动 #58a17a3e7的最新差异,二者均未合入。新建取消仍由 stop/create 协议控制;更新仍通过 start 锁阻断 compact 和离线 info。fd83a64、test(emu): 覆盖 compact 对 backing 数据的保留 #568d3576e与本补丁,应用无冲突。新建取消定向回归及锁回归通过,update、CLI、MCP、UI 包通过。上述 PR 的代码没有带入本分支。测试限制:
go test -p 1 ./... -count=1均未全绿,分别在未修改测试 TestCreateProgressOnDisk、TestDiskCompactIntegration、TestCreatePlanOfSetup 的 TempDir RemoveAll 阶段报告“目录不是空的”。组合分支同样在 TestCreateSetsUp 清理时失败。没有功能断言失败,也没有修改这些测试的清理逻辑。