[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/1] qemu-nbd: add the option to use pre-created
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 1/1] qemu-nbd: add the option to use pre-created server socket |
Date: |
Thu, 29 Sep 2016 10:05:55 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
On 09/29/2016 06:02 AM, Denis V. Lunev wrote:
> From: Denis Plotnikov <address@hidden>
>
> Originally NBD server socket was created by qemu-nbd code. This leads to
> the race when the management layer starts qemu-nbd server and allows a
> client to connect to the server. In this case there is a possibility that
> qemu-nbd does not open listening server socket yet. Creating listening
> socket before starting of qemu-ndb and passing socket fd via command line
> solves this issue completely.
>
> Signed-off-by: Denis Plotnikov <address@hidden>
> Reviewed-by: Roman Kagan <address@hidden>
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Paolo Bonzini <address@hidden>
> ---
> @@ -78,6 +79,7 @@ static void usage(const char *name)
> " -b, --bind=IFACE interface to bind to (default `0.0.0.0')\n"
> " -k, --socket=PATH path to the unix socket\n"
> " (default '"SOCKET_PATH"')\n"
> +" --server-sock-fd=NUM pre-opened listening server socket file
> descriptor\n"
> " -e, --shared=NUM device can be shared by NUM clients (default
> '1')\n"
Looking at 'qemu-nbd --help', all other long-option-only options are
indented so that the -- line up to the same column (see for example
--cache and --aio).
>
> -static SocketAddress *nbd_build_socket_address(const char *sockpath,
> +static SocketAddress *nbd_build_sock_fd(const char *sockpath,
> const char *bindto,
> const char *port)
Indentation now looks off.
> +static void setup_address_and_port(const char **address, const char **port)
> +{
> + if (*address == NULL) {
> + *address = "0.0.0.0";
> + }
> +
> + if (*port == NULL) {
> + *port = g_strdup_printf("%d", NBD_DEFAULT_PORT);;
s/;;/;/
Why is one of these parameters malloc'd, but the other pointing to const
storage? Do you have a memory leak, or else a risk of corrupting
read-only memory?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature