qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Liu Yuan <namei.unix@gmail.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] 100% CPU when sockfd is half-closed and unexpected behavior for qemu_co_send()
Date: Mon, 14 Jan 2013 11:07:51 +0100	[thread overview]
Message-ID: <50F3D8F7.5010400@redhat.com> (raw)
In-Reply-To: <50F3CFDD.2000003@gmail.com>

Il 14/01/2013 10:29, Liu Yuan ha scritto:
> I don't think so. I use netstat to assure that the connection is in
> closed_wait state and I added a printf in the qemu_co_send() and it
> indeed sent successfully, this can be backed by the Linux kernel
> source code:
> 
> static ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
>                                 size_t size, int flags)
> {
>          ....
>         /* Wait for a connection to finish. One exception is TCP Fast Open
>          * (passive side) where data is allowed to be sent before a connection
>          * is fully established.
>          */
>         if (((1 << sk->sk_state) & ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)) &&
>             !tcp_passive_fastopen(sk)) {
>                 if ((err = sk_stream_wait_connect(sk, &timeo)) != 0)
>                         goto out_err;
>         }
>         ....
> }
> 
> which will put data in the sock buf and returns successful in a
> CLOSED_WAIT state. I don't see means in Sheepdog driver code to get a
> HUP notification for a actual cut off connection.

Ok.  I guess the problem is that we use select(), not poll(), so we have
no way to get POLLHUP notifications.  But the write fd_set receives the
file descriptor because indeed writes will not block.

Stefan, Anthony, any ideas?

Paolo

  reply	other threads:[~2013-01-14 10:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14  8:16 [Qemu-devel] 100% CPU when sockfd is half-closed and unexpected behavior for qemu_co_send() Liu Yuan
2013-01-14  9:09 ` Paolo Bonzini
2013-01-14  9:29   ` Liu Yuan
2013-01-14 10:07     ` Paolo Bonzini [this message]
2013-01-16  6:39       ` Liu Yuan
2013-01-14 10:23 ` Stefan Hajnoczi
2013-01-14 10:26   ` Liu Yuan

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=50F3D8F7.5010400@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=namei.unix@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).