[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 22/27] nbd: Improve server handling of shutdown r
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PULL 22/27] nbd: Improve server handling of shutdown requests |
Date: |
Mon, 31 Oct 2016 13:05:09 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 10/31/2016 09:37 AM, Paolo Bonzini wrote:
> From: Eric Blake <address@hidden>
>
> NBD commit 6d34500b clarified how clients and servers are supposed
> to behave before closing a connection. It added NBD_REP_ERR_SHUTDOWN
> (for the server to announce it is about to go away during option
> haggling, so the client should quit sending NBD_OPT_* other than
> NBD_OPT_ABORT) and ESHUTDOWN (for the server to announce it is about
> to go away during transmission, so the client should quit sending
> NBD_CMD_* other than NBD_CMD_DISC). It also clarified that
> NBD_OPT_ABORT gets a reply, while NBD_CMD_DISC does not.
>
> This patch merely adds the missing reply to NBD_OPT_ABORT and teaches
> the client to recognize server errors. Actually teaching the server
> to send NBD_REP_ERR_SHUTDOWN or ESHUTDOWN would require knowing that
> the server has been requested to shut down soon (maybe we could do
> that by installing a SIGINT handler in qemu-nbd, which transitions
> from RUNNING to a new state that waits for the client to react,
> rather than just out-right quitting - but that's a bigger task for
> another day).
>
> Signed-off-by: Eric Blake <address@hidden>
> Message-Id: <address@hidden>
> [Move dummy ESHUTDOWN to include/qemu/osdep.h. - Paolo]
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
> +++ b/include/qemu/osdep.h
> @@ -128,6 +128,9 @@ extern int daemon(int, int);
> #if !defined(EMEDIUMTYPE)
> #define EMEDIUMTYPE 4098
> #endif
> +#if !defined(ESHUTDOWN)
> +#define ESHUTDOWN 4099
> +#endif
Technically, with this code in place...
> +++ b/nbd/server.c
> @@ -39,6 +39,10 @@ static int system_errno_to_nbd_errno(int err)
> case EFBIG:
> case ENOSPC:
> return NBD_ENOSPC;
> +#ifdef ESHUTDOWN
> + case ESHUTDOWN:
> + return NBD_ESHUTDOWN;
> +#endif
...the #ifdef here is pointless.
Can be cleaned up in a followup, so should not stop the pull request.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PULL 12/27] nbd: Rename NbdClientSession to NBDClientSession, (continued)
- [Qemu-devel] [PULL 12/27] nbd: Rename NbdClientSession to NBDClientSession, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 14/27] nbd: Share common reply-sending code in server, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 13/27] nbd: Rename struct nbd_request and nbd_reply, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 15/27] nbd: Send message along with server NBD_REP_ERR errors, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 17/27] nbd: Let server know when client gives up negotiation, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 19/27] nbd: Less allocation during NBD_OPT_LIST, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 21/27] nbd: Refactor conversion to errno to silence checkpatch, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 18/27] nbd: Let client skip portions of server reply, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 20/27] nbd: Support shorter handshake, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 22/27] nbd: Improve server handling of shutdown requests, Paolo Bonzini, 2016/10/31
- Re: [Qemu-devel] [PULL 22/27] nbd: Improve server handling of shutdown requests,
Eric Blake <=
- [Qemu-devel] [PULL 23/27] nbd: Implement NBD_CMD_WRITE_ZEROES on server, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 16/27] nbd: Share common option-sending code in client, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 24/27] nbd: Implement NBD_CMD_WRITE_ZEROES on client, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 25/27] qemu-char: do not forward events through the mux until QEMU has started, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 26/27] slirp: fix CharDriver breakage, Paolo Bonzini, 2016/10/31
- [Qemu-devel] [PULL 27/27] x86: add AVX512_4VNNIW and AVX512_4FMAPS features, Paolo Bonzini, 2016/10/31
- Re: [Qemu-devel] [PULL 00/27] Misc patches for 2016-10-31, Peter Maydell, 2016/10/31