Re: [Nbd] [PATCH] docs/proto: clarify NBD_CMD_FLUSH
- To: Paolo Bonzini <pbonzini@...696...>
- Cc: kwolf@...696..., nbd-general@...72...
- Subject: Re: [Nbd] [PATCH] docs/proto: clarify NBD_CMD_FLUSH
- From: Wouter Verhelst <w@...112...>
- Date: Thu, 14 May 2015 12:33:05 +0200
- Message-id: <20150514103305.GC20175@...3...>
- In-reply-to: <1431080176-9065-1-git-send-email-pbonzini@...696...>
- References: <1431080176-9065-1-git-send-email-pbonzini@...696...>
On Fri, May 08, 2015 at 12:16:16PM +0200, Paolo Bonzini wrote:
> There are two problems:
>
> 1) A literal reading of the specification could imply that the server could
> not send a reply if fsync() fails, because in that case previous writes
> have not reached the disk. Of course, this part of the specification only
> applies to successful replies.
>
> 2) Flush does not apply to outstanding writes. It applies to _completed_
> writes, ensuring that they also hit the disk.
Er, I always thought it was supposed to imply ordering as well. If you
send write request A, then write request B, then receive a reply message
for B, and then (before receiving reply for A) send a flush request,
the flush reply message should not be sent before A *and* B are
finished; that was my understanding.
Of course, this nbd server doesn't actually care either way, because it
"just" does fsync(), without disordering writes. So I suppose what
matters is the Linux kernel's semantics in this regard for flush
messages; does it care? If not, an asynchronous implementation of
nbd-server would be much simpler (because no synchronisation is
necessary); but if it does, we shouldn't change that part of the
protocol--and if we're not sure we should probably not change it either,
just to be on the safe side.
--
It is easy to love a country that is famous for chocolate and beer
-- Barack Obama, speaking in Brussels, Belgium, 2014-03-26
Reply to: