[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [PATCH] Don't error on NBD_FLAG_CMD_FUA on non-writes



On 04/06/2016 09:11 AM, Eric Blake wrote:
> Commit ab22e082 changed the server to reject all unknown
> flags with EINVAL, but in the process broke qemu as a client
> (which in qemu 2.5 unconditionally FUA on NBD_CMD_FLUSH).

s/FUA/sets FUA/

> Commit e82baa5f relaxed the protocol to explicitly document
> that servers must not reject FUA on any command (but MAY
> ignore it where the command does not actually cause a write).
> Fix the reference implementation to match.
> 
> Signed-off-by: Eric Blake <eblake@...696...>
> ---
>  nbd-server.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/nbd-server.c b/nbd-server.c
> index b222a11..4edb883 100644
> --- a/nbd-server.c
> +++ b/nbd-server.c
> @@ -1523,7 +1523,7 @@ static void handle_request(gpointer data, gpointer user_data) {
>  	uint32_t flags = package->req->type & ~NBD_CMD_MASK_COMMAND;
>  	struct nbd_reply rep;
> 
> -	if(flags != 0 && (type != NBD_CMD_WRITE || flags != NBD_CMD_FLAG_FUA)) {
> +	if(flags & ~NBD_CMD_FLAG_FUA) {
>  		msg(LOG_ERR, "E: received invalid flag %d on command %d, ignoring", flags, type);
>  		goto error;
>  	}
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: