Re: bio re-ordering

From: Andriy Gapon <>
Date: Wed, 02 Feb 2022 09:49:44 UTC
On 02/02/2022 11:14, Warner Losh wrote:
> On Wed, Feb 2, 2022 at 2:05 AM Andriy Gapon < 
> <>> 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.

> It will be the only way for it to be reliable with nvme, since the 
> command isn't ordered w/o BIO_ORDERED flag. So ggate needn't do anything
> special for BIO_FLUSH, just BIO_ORDERED. Otherwise, it's free to reorder as it
> sees fit.
> The CAM I/O scheduler takes a little bit of liberty here, btw. It interprets 
> as being only wrt BIO_WRITE and BIO_FLUSH because if you schedule both a read
> and write, the results are undefined. nvd takes a stricter approach and honors 
> the ordering
> more strictly.
> Warner

Andriy Gapon