From: Paolo Bonzini <pbonzini@redhat.com>
To: Hani Benhabiles <kroosec@gmail.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com,
mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH 3/3] nbd: Shutdown socket before closing.
Date: Tue, 03 Jun 2014 13:33:41 +0200 [thread overview]
Message-ID: <538DB295.2020508@redhat.com> (raw)
In-Reply-To: <1401572382-11667-4-git-send-email-kroosec@gmail.com>
Il 31/05/2014 23:39, Hani Benhabiles ha scritto:
> This forces finishing data sending to client before closing the socket like in
> exports listing or replying with NBD_REP_ERR_UNSUP cases.
>
> Signed-off-by: Hani Benhabiles <hani@linux.com>
> ---
> blockdev-nbd.c | 1 +
> qemu-nbd.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/blockdev-nbd.c b/blockdev-nbd.c
> index b60b66d..e609f66 100644
> --- a/blockdev-nbd.c
> +++ b/blockdev-nbd.c
> @@ -28,6 +28,7 @@ static void nbd_accept(void *opaque)
>
> int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len);
> if (fd >= 0 && !nbd_client_new(NULL, fd, nbd_client_put)) {
> + shutdown(fd, SHUT_RDWR);
> close(fd);
> }
> }
> diff --git a/qemu-nbd.c b/qemu-nbd.c
> index ba60436..bf42861 100644
> --- a/qemu-nbd.c
> +++ b/qemu-nbd.c
> @@ -372,6 +372,7 @@ static void nbd_accept(void *opaque)
> if (nbd_client_new(exp, fd, nbd_client_closed)) {
> nb_fds++;
> } else {
> + shutdown(fd, SHUT_RDWR);
> close(fd);
> }
> }
>
IIUC, what this does is ensure that the other side gets a FIN before it
gets a RST. Is this correct?
Paolo
next prev parent reply other threads:[~2014-06-03 11:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1401572382-11667-1-git-send-email-kroosec@gmail.com>
[not found] ` <1401572382-11667-2-git-send-email-kroosec@gmail.com>
2014-06-02 12:32 ` [Qemu-devel] [PATCH 1/3] nbd: Handle fixed new-style clients Stefan Hajnoczi
2014-06-02 22:09 ` Hani Benhabiles
2014-06-04 8:01 ` Stefan Hajnoczi
[not found] ` <1401572382-11667-4-git-send-email-kroosec@gmail.com>
2014-06-03 11:33 ` Paolo Bonzini [this message]
2014-06-04 22:33 ` [Qemu-devel] [PATCH 3/3] nbd: Shutdown socket before closing Hani Benhabiles
2014-06-05 1:55 ` Paolo Bonzini
2014-06-05 9:58 ` Hani Benhabiles
2014-06-05 10:31 ` Paolo Bonzini
[not found] ` <1401572382-11667-3-git-send-email-kroosec@gmail.com>
2014-06-03 11:36 ` [Qemu-devel] [PATCH 2/3] nbd: Add exports listing support Paolo Bonzini
2014-06-04 22:35 ` Hani Benhabiles
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=538DB295.2020508@redhat.com \
--to=pbonzini@redhat.com \
--cc=famz@redhat.com \
--cc=kroosec@gmail.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.