Dan Luu 写系统问题时,习惯先测量、再对照、最后才下结论。把「Filesystem error handling」放到智能体、评测和线上系统里,真正要问的是:默认做法会不会系统性失败。下面用中文整理成可执行的工程笔记,去掉原站导航和无关链接。

Error injection

We’re going to reproduce some results from papers on filesystem robustness that were written up roughly a decade ago : Prabhakaran et al. SOSP 05 paper , which injected errors below the filesystem and Gunawi et al. FAST 08 , which looked at how often filesystems failed to check return codes of functions that can return errors.

Prabhakaran et al. injected errors at the block device level (just underneath the filesystem) and found that ext3 , resierfs , ntfs , and jfs mostly handled read errors reasonbly but ext3 , ntfs , and jfs mostly ignored write errors. While the paper is interesting, someone installing Linux on a system today is much more likely to use ext4 than any of the now-dated filesystems tested by Prahbhakaran et al. We’ll try to reproduce some of the basic results fr

Internal error handling

Gunawi et al. found that errors weren’t checked most of the time. After we look at error injection on modern filesystems, we’ll look at how much (or little) filesystems have improved their error handling code.

A cartoon view of a file read might be: pread syscall -> OS generic filesystem code -> filesystem specific code -> block device code -> device driver -> device controller -> disk . Once the disk gets the request, it sends the data back up: disk -> device controller -> device driver -> block device code -> filesystem specific code -> OS generic filesystem code -> pread . We’re going to look at error injection at the block device level, right below the file

Conclusion

Let’s look at what happened when we injected errors in 2017 vs. what Prabhakaran et al. found in 2005.

2005 2017 read write silent read write silent read write silent file mmap btrfs prop prop prop prop prop prop exfat prop prop ignore prop prop ignore ext3 prop ignore ignore prop prop ignore prop prop ignore ext4 prop prop ignore prop prop ignore fat prop prop ignore prop prop ignore jfs prop ignore ignore prop ignore ignore prop prop ignore reiserfs prop prop ignore xfs prop prop ignore prop prop ignore

Appendix: error handling in C

Each row shows results for one filesystem. read and write indicating reading and writing data, respectively, where the block device returns an error indicating that the operation failed. silent indicates a read failure (incorrect data) where the block device didn’t indicate an error. This could happen if there’s disk corruption, a transient read failure, or a transient write failure silently caused bad data to be written. file indicates that the operation

From the table, we can see that, in 2005, ext3 and jfs ignored write errors even when the block device indicated that the write failed and that things have improved, and that any filesystem you’re likely to use will correctly tell you that a write failed. jfs hasn’t improved, but jfs is now rarely used outside of legacy installations.

Appendix: why wasn't this done earlier?

No tested filesystem other than btrfs handled silent failures correctly. The other filesystems tested neither duplicate nor checksum data, making it impossible for them to detect silent failures. zfs would probably also handle silent failures correctly but wasn’t tested. apfs , despite post-dating btrfs and zfs , made the explicit decision to not checksum data and silently fail on silent block device errors. We’ll discuss this more later.

In all cases tested where errors were propagated, file reads and writes returned EIO from pread or pwrite , respectively; mmap reads and writes caused the process to receive a SIGBUS signal.

Appendix: experimental setup

The 2017 tests above used an 8k file where the first block that contained file data either returned an error at the block device level or was corrupted, depending on the test. The table below tests the same thing, but with a 445 byte file instead of an 8k file. The choice of 445 was arbitrary.

In the small file test table, all the results are the same, except for btrfs , which returns correct data in every case tested. What’s happening here is that the filesystem was created on a rotational disk and, by default, btrfs duplicates filesystem metadata on rotational disks (it can be configured to do so on SSDs, but that’s not the default). Since the file was tiny, btrfs packed the file into the metadata and the file was duplicated along with the met

落地时建议先做的 5 件事

  1. 用自己的真实负载测,而不是只用公开榜或厂商数字。
  2. 把评测设计成能抓到失败模式:平均分好看但尾部崩溃,仍然算失败。
  3. 智能体默认不会好好用测试;要写进流程,而不是写在口头规范里。
  4. 性能和正确性都要有基线,改模型或改语言前后必须能对比。
  5. 结论写成可回滚的决策:哪一版配置、哪一版评测集、谁签字。

和智能体产品怎么接

龙虾PRO做 OpenClaw 落地时,同样吃「先测量再扩面」这条纪律:技能、数字员工和网关都要有可复现评测,而不是只看一次演示通过。

效率龙虾 会带着下面这段开聊

按文章《文件系统出错时程序通常没处理好》把卡点收成可执行步骤:先做什么、别踩哪条、怎么验证。

用效率龙虾试这篇

本文侧重全链路风控方法论。落地时请用自身业务单据做回放验证,不要把示例阈值直接当生产策略。 相关:风控体检 · 方案资源

常见问题 FAQ

什么是AI智能系统?

「AI智能系统」可概括为:We’re going to reproduce some results from papers on filesystem robustness that were written up roughly a decade ago : Prabhakaran et al. SOSP 05 paper , which injected errors belo 本文从定义、方法与实践要点展开说明。

为什么要关注AI智能系统?

关注AI智能系统,是因为它直接影响效率、风险与可复制性。文中指出:We’re going to reproduce some results from papers on filesystem robustness that were written up roughly a decade ago : Prabhakaran et al. SOSP 05 paper , which injected errors below the filesystem and Gunawi et al. FAST 08 , which looked at how o…

如何落地AI智能系统?有哪些关键步骤?

建议按以下路径推进AI智能系统:1) 用自己的真实负载测,而不是只用公开榜或厂商数字。;2) 把评测设计成能抓到失败模式:平均分好看但尾部崩溃,仍然算失败。;3) 智能体默认不会好好用测试;要写进流程,而不是写在口头规范里。;4) 性能和正确性都要有基线,改模型或改语言前后必须能对比。;5) 结论写成可回滚的决策:哪一版配置、哪一版评测集、谁签字。。细节见正文对应章节。

AI智能系统适合哪些人或团队?

AI智能系统更适合:产品/技术负责人、运营与增长团队、需要落地智能体或自动化的中小团队、关注「AI智能系统」方向的读者。若你只需要单次聊天式问答,可先读概念;若要上生产,请重点看步骤、权限与风控相关段落。

关于「Error injection」,本文给出了什么结论?

在「Error injection」部分,要点是:the filesystem and Gunawi et al. FAST 08 , which looked at how often filesystems failed to check return codes of functions that can return errors. Prabhakaran et al. injected errors at the block device level (just under

关于「Internal error handling」,本文给出了什么结论?

在「Internal error handling」部分,要点是:eir error handling code. A cartoon view of a file read might be: pread syscall -> OS generic filesystem code -> filesystem specific code -> block device code -> device driver -> device controller -> disk . Once the disk