Re: Fix potential data loss and corruption due to Incorrect BIO Chain Handling

Christoph Hellwig
2025-11-24T06:22:47Z

On Sat, Nov 22, 2025 at 02:38:59PM +0800, Stephen Zhang wrote:
> ======code analysis======
> In kernel version 4.19, XFS handles extent I/O using the ioend structure,

Linux 4.19 is more than four years old, and both the block I/O code
and the XFS/iomap code changed a lot since then.

> changes the logic. Since there are still many code paths that use
> bio_chain, I am including these cleanups with the fix. This provides a reason
> to CC all related communities. That way, developers who are monitoring
> this can help identify similar problems if someone asks for help in the future,
> if that is the right analysis and fix.

As many pointed out something in the analysis doesn't end up. How do
you even managed to call bio_chain_endio as almost no one should be
calling it. Are you using bcache? Are the others callers in the
obsolete kernel you are using? Are they calling it without calling
bio_endio first (which the bcache case does, and which is buggy).