qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH for-4.0] nbd: Permit simple error to NBD_CMD_BLO


From: Eric Blake
Subject: Re: [Qemu-block] [PATCH for-4.0] nbd: Permit simple error to NBD_CMD_BLOCK_STATUS
Date: Mon, 25 Mar 2019 11:52:35 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0

On 3/25/19 11:05 AM, Eric Blake wrote:

> More to the point, the behavior of qemu for a (structured) error reply
> to NBD_CMD_BLOCK_STATUS with no extent->length was to keep the
> connection alive (both before and after commit 7f86068d) - the
> difference in behavior for this hunk of the patch is only visible for
> simple error replies. (Here's the hacks I applied to the server, to test
> forced error replies to NBD_CMD_BLOCK_STATUS, whether structured or simple:
> 
> 
> From 22b4181f887d3b782695dbb11fcc1759281fc51e Mon Sep 17 00:00:00 2001
> From: Eric Blake <address@hidden>
> Date: Sat, 23 Mar 2019 07:19:33 -0500
> Subject: [PATCH 1/2] nbd: Debug patch to force NBD_CMD_BLOCK_STATUS failure
> 
> Hack to test whether the client is robust to block status failure.
> 
> Signed-off-by: Eric Blake <address@hidden>
> ---
>  nbd/server.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/nbd/server.c b/nbd/server.c
> index fd013a2817a..94d0c9f4e9e 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -2269,6 +2269,8 @@ static coroutine_fn int
> nbd_handle_request(NBDClient *client,
>                                        "discard failed", errp);
> 
>      case NBD_CMD_BLOCK_STATUS:
> +        return nbd_send_generic_reply(client, request->handle, -EINVAL,

As long as I'm hacking things, forcing -ENOMEM here is more instructive
(as both -EINVAL and -EIO can be set in client-side code in nbd-client.c
regardless of what the server sent, but -ENOMEM is a fairly reliable
witness of the actual error message being reported by the server). That
is, when trying to decipher what clients do to a particular forced
server error, seeing the server's 'Cannot allocate memory' is a good
sign that the error message properly transferred across all the needed
layers, rather than getting replaced somewhere along the way.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]