Re: [Nbd] [RESEND][PATCH 0/5] nbd improvements

From: Alex Bligh
Date: Thu Sep 15 2016 - 11:24:02 EST


> On 15 Sep 2016, at 15:07, Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
> I don't think QEMU forbids multiple clients to the single server, and
> guarantees consistency as long as there is no overlap between writes and
> reads. These are the same guarantees you have for multiple commands on
> a single connection.
> In other words, from the POV of QEMU there's no difference whether
> multiple commands come from one or more connections.

This isn't really about ordering, it's about cache coherency
and persisting things to disk.

What you say is correct as far as it goes in terms of ordering. However
consider the scenario with read and writes on two channels as follows
of the same block:

Channel1 Channel2

R Block read, and cached in user space in
channel 1's cache
Reply sent

W New value written, channel 2's cache updated
channel 1's cache not

R Value returned from channel 1's cache.

In the above scenario, there is a problem if the server(s) handling the
two channels each use a read cache which is not coherent between the
two channels. An example would be a read-through cache on a server that
did fork() and shared no state between connections.

Similarly, if there is a write on channel 1 that has completed, and
the flush goes to channel 2, it may not (if state is not shared) guarantee
that the write on channel 1 (which has completed) is persisted to non-volatile
media. Obviously if the 'state' is OS block cache/buffers/whatever, it
will, but if it's (e.g.) a user-space per process write-through cache,
it won't.

I don't know whether qemu-nbd is likely to suffer from either of these.

Alex Bligh

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail