On Tue, Jul 09, 2019 at 08:15:08AM +1000, Dave Chinner wrote: > That fixes the problem I saw, but I think bio_chain() needs some > more checks to prevent this happening in future. It's trivially > easy to chain the bios in the wrong order, very difficult to spot > in review, and difficult to trigger in testing as it requires > chain nesting and adverse IO timing to expose.... Not sure how we can better check it. At best we can set a flag for a bio that is a chain "child" and complain if someone is calling submit_bio_wait, but that would only really cover the wait case. But one thing I planned to do is to lift xfs_chain_bio to the block layer so that people can use it for any kind of continuation bio instead of duplicating the logic.