Re: [PATCH] virtio pmem: fix async flush ordering

From: Dan Williams
Date: Fri Nov 22 2019 - 00:17:52 EST


On Thu, Nov 21, 2019 at 8:38 PM Pankaj Gupta <pagupta@xxxxxxxxxx> wrote:
>
>
> > > > > >
> > > > > > > Remove logic to create child bio in the async flush function which
> > > > > > > causes child bio to get executed after parent bio
> > > > > > > 'pmem_make_request'
> > > > > > > completes. This resulted in wrong ordering of REQ_PREFLUSH with
> > > > > > > the
> > > > > > > data write request.
> > > > > > >
> > > > > > > Instead we are performing flush from the parent bio to maintain
> > > > > > > the
> > > > > > > correct order. Also, returning from function 'pmem_make_request'
> > > > > > > if
> > > > > > > REQ_PREFLUSH returns an error.
> > > > > > >
> > > > > > > Reported-by: Jeff Moyer <jmoyer@xxxxxxxxxx>
> > > > > > > Signed-off-by: Pankaj Gupta <pagupta@xxxxxxxxxx>
> > > > > >
> > > > > > There's a slight change in behavior for the error path in the
> > > > > > virtio_pmem driver. Previously, all errors from virtio_pmem_flush
> > > > > > were
> > > > > > converted to -EIO. Now, they are reported as-is. I think this is
> > > > > > actually an improvement.
> > > > > >
> > > > > > I'll also note that the current behavior can result in data
> > > > > > corruption,
> > > > > > so this should be tagged for stable.
> > > > >
> > > > > I added that and was about to push this out, but what about the fact
> > > > > that now the guest will synchronously wait for flushing to occur. The
> > > > > goal of the child bio was to allow that to be an I/O wait with
> > > > > overlapping I/O, or at least not blocking the submission thread. Does
> > > > > the block layer synchronously wait for PREFLUSH requests? If not I
> > > > > think a synchronous wait is going to be a significant performance
> > > > > regression. Are there any numbers to accompany this change?
> > > >
> > > > Why not just swap the parent child relationship in the PREFLUSH case?
> > >
> > > I we are already inside parent bio "make_request" function and we create
> > > child
> > > bio. How we exactly will swap the parent/child relationship for PREFLUSH
> > > case?
> > >
> > > Child bio is queued after parent bio completes.
> >
> > Sorry, I didn't quite mean with bio_split, but issuing another request
> > in front of the real bio. See md_flush_request() for inspiration.
>
> o.k. Thank you. Will try to post patch today to be considered for 5.4.
>

I think it is too late for v5.4-final, but we can get it in the
-stable queue. Let's take the time to do it right and get some testing
on it.