Re: bio re-ordering

From: Peter Jeremy <peterj_at_freebsd.org>
Date: Sat, 05 Feb 2022 09:50:08 UTC
On 2022-Feb-02 11:49:44 +0200, Andriy Gapon <avg@freebsd.org> wrote:
>On 02/02/2022 11:14, Warner Losh wrote:
>> On Wed, Feb 2, 2022 at 2:05 AM Andriy Gapon <avg@freebsd.org 
>> <mailto:avg@freebsd.org>> wrote:
>>     Hmm... it looks like both the old and new (Open)ZFS use BIO_FLUSH command
>>     without BIO_ORDERED flag.  Not sure if it happens to do the right thing anyway
>>     or not.
>> 
>> 
>> It's an unordered flush then. The flush will happen whenever. I have a vague
>> memory that ZFS will only issue this command in cases where there's no other I/O
>> pending.
>
>I think that there is still a potential problem that an earlier write request 
>might get re-ordered after the flush.
>I think that we should add BIO_ORDERED for correctness.

I've raised https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261731 to
make geom_gate support BIO_ORDERED.  Exposing the BIO_ORDERED flag to
userland is quite easy (once a decision is made as to how to do that).
Enhancing the geom_gate clients to correctly implement BIO_ORDERED is
somewhat harder.

I've done some experiments and OpenZFS doesn't generate BIO_ORDERED
operations so I've also raised https://github.com/openzfs/zfs/issues/13065
I haven't looked into how difficult that would be to fix.

-- 
Peter Jeremy