qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-2.6] nbd: don't request FUA on FLUSH
@ 2016-04-01 16:08 Eric Blake
  2016-04-04  7:34 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Blake @ 2016-04-01 16:08 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, pbonzini, open list:Block layer core

The NBD protocol does not clearly document what will happen
if a client sends NBD_CMD_FLAG_FUA on NBD_CMD_FLUSH.
Historically, both the qemu and upstream NBD servers silently
ignored that flag, but that feels a bit risky.  Meanwhile, the
qemu NBD client unconditionally sends the flag (without even
bothering to check whether the caller cares; at least with
NBD_CMD_WRITE the client only sends FUA if requested by a
higher layer).

There is ongoing discussion on the NBD list to fix the
protocol documentation to require that the server MUST ignore
the flag (unless the kernel folks can better explain what FUA
means for a flush), but until those doc improvements land, the
current nbd.git master was recently changed to reject the flag
with EINVAL (see nbd commit ab22e082), which now makes it
impossible for a qemu client to use FLUSH with an upstream NBD
server.

We should not send FUA with flush unless the upstream protocol
documents what it will do, and even then, it should be something
that the caller can opt into, rather than being unconditional.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 block/nbd-client.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/block/nbd-client.c b/block/nbd-client.c
index 021a88b..878e879 100644
--- a/block/nbd-client.c
+++ b/block/nbd-client.c
@@ -319,10 +319,6 @@ int nbd_client_co_flush(BlockDriverState *bs)
         return 0;
     }

-    if (client->nbdflags & NBD_FLAG_SEND_FUA) {
-        request.type |= NBD_CMD_FLAG_FUA;
-    }
-
     request.from = 0;
     request.len = 0;

-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH for-2.6] nbd: don't request FUA on FLUSH
  2016-04-01 16:08 [Qemu-devel] [PATCH for-2.6] nbd: don't request FUA on FLUSH Eric Blake
@ 2016-04-04  7:34 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-04-04  7:34 UTC (permalink / raw)
  To: Eric Blake, qemu-devel; +Cc: Kevin Wolf, open list:Block layer core



On 01/04/2016 18:08, Eric Blake wrote:
> The NBD protocol does not clearly document what will happen
> if a client sends NBD_CMD_FLAG_FUA on NBD_CMD_FLUSH.
> Historically, both the qemu and upstream NBD servers silently
> ignored that flag, but that feels a bit risky.  Meanwhile, the
> qemu NBD client unconditionally sends the flag (without even
> bothering to check whether the caller cares; at least with
> NBD_CMD_WRITE the client only sends FUA if requested by a
> higher layer).
> 
> There is ongoing discussion on the NBD list to fix the
> protocol documentation to require that the server MUST ignore
> the flag (unless the kernel folks can better explain what FUA
> means for a flush), but until those doc improvements land, the
> current nbd.git master was recently changed to reject the flag
> with EINVAL (see nbd commit ab22e082), which now makes it
> impossible for a qemu client to use FLUSH with an upstream NBD
> server.
> 
> We should not send FUA with flush unless the upstream protocol
> documents what it will do, and even then, it should be something
> that the caller can opt into, rather than being unconditional.
> 
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  block/nbd-client.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/block/nbd-client.c b/block/nbd-client.c
> index 021a88b..878e879 100644
> --- a/block/nbd-client.c
> +++ b/block/nbd-client.c
> @@ -319,10 +319,6 @@ int nbd_client_co_flush(BlockDriverState *bs)
>          return 0;
>      }
> 
> -    if (client->nbdflags & NBD_FLAG_SEND_FUA) {
> -        request.type |= NBD_CMD_FLAG_FUA;
> -    }
> -
>      request.from = 0;
>      request.len = 0;
> 

Thanks, queued for 2.6.

Paolo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-04  7:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-01 16:08 [Qemu-devel] [PATCH for-2.6] nbd: don't request FUA on FLUSH Eric Blake
2016-04-04  7:34 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).