Hi Eric and Sami, Thank you both for your careful review and guidance.
Eric, thank you for explaining why an I/O error must not be escalated to corruption, and for recommending that FEC decode into fio->output first and then populate the cache atomically. Thank you also for accepting the shutdown workaround into mainline and cherry-picking it to the Android Common Kernel branches. Sami, thank you for pointing out that erasure lookup is optional and that a verification failure while looking up erasures should not be treated as a fatal corruption error. Your suggestion helped us separate the erasure lookup error handling from the real corruption path. Based on your feedback, we have prepared the attached four-patch series against our 6.18 branch: 1. Backport the shutdown workaround that is already in mainline. This is included only to make our branch series complete; it is not intended as a duplicate upstream change. 2. Add NF_FILLED and dm_bufio_new_filled() to dm-bufio. The supplied data is copied into the buffer before cache_insert() makes it visible to other readers. Existing dm-bufio APIs keep their previous behavior. 3. Prevent FEC from publishing uninitialized hash blocks. FEC now decodes into the per-I/O private fio->output buffer. After successful decoding and hash verification, dm-verity publishes the corrected data with dm_bufio_new_filled(). Because dm_bufio_new_filled() can return an existing cached buffer and ignore the supplied data, we compare the returned contents with fio->output. We set hash_verified only if they match. If publication fails, or the existing buffer contains different data, the current verification falls back to the verified private output and releases the buffer reference where necessary. 4. Avoid corruption policy during FEC erasure lookup. A hash-tree failure while looking up erasures now returns -EIO as "erasure information unavailable" instead of invoking the corruption policy. The normal verification path still handles real corruption as before. Could you please review this series, especially patches 2-4, and check whether it implements the intended root-cause fix correctly? In particular, we would appreciate your feedback on: - whether NF_FILLED is an appropriate minimal dm-bufio interface; - whether the cache-hit handling, private-output fallback, reference counting, and hash_verified updates are correct; - whether any cache-visibility or concurrency window remains; - whether the erasure lookup error-policy isolation is sufficiently narrow; and - whether there is a simpler or more appropriate solution. We are concerned that we may have overlooked a corner case in concurrency, cache lifetime, FEC recovery, or error handling and could inadvertently introduce a regression. If you see a better approach, we would be very happy to rework the patches according to your suggestions. We are currently preparing a build for stress testing, and the final four-patch series has not yet undergone actual validation. Thank you again for your time and guidance. Best regards, Weijiang Zhou ________________________________ This email (including its attachments) is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorized use, dissemination, distribution or copying of this email or the information herein or taking any action in reliance on the contents of this email or the information herein, by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is strictly prohibited. If you are not the intended recipient, please do not read, copy, use or disclose any part of this e-mail to others. Please notify the sender immediately and permanently delete this e-mail and any attachments if you received it in error. Internet communications cannot be guaranteed to be timely, secure, error-free or virus-free. The sender does not accept liability for any errors or omissions. 本邮件及其附件具有保密性质,受法律保护不得泄露,仅发送给本邮件所指特定收件人。严禁非经授权使用、宣传、发布或复制本邮件或其内容。若非该特定收件人,请勿阅读、复制、 使用或披露本邮件的任何内容。若误收本邮件,请从系统中永久性删除本邮件及所有附件,并以回复邮件的方式即刻告知发件人。无法保证互联网通信及时、安全、无误或防毒。发件人对任何错漏均不承担责任。
0001-Bug-3623141-UPSTREAM-dm-verity-don-t-restart-or-pani.patch
Description: 0001-Bug-3623141-UPSTREAM-dm-verity-don-t-restart-or-pani.patch
0002-Bug-3623141-dm-bufio-support-atomic-publication-of-p.patch
Description: 0002-Bug-3623141-dm-bufio-support-atomic-publication-of-p.patch
0003-Bug-3623141-dm-verity-prevent-FEC-from-publishing-un.patch
Description: 0003-Bug-3623141-dm-verity-prevent-FEC-from-publishing-un.patch
0004-Bug-3623141-dm-verity-avoid-corruption-policy-during.patch
Description: 0004-Bug-3623141-dm-verity-avoid-corruption-policy-during.patch
