From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TugxV-0002yq-7r for qemu-devel@nongnu.org; Mon, 14 Jan 2013 05:08:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TugxP-0008F8-EM for qemu-devel@nongnu.org; Mon, 14 Jan 2013 05:08:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26867) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TugxP-0008Eq-7O for qemu-devel@nongnu.org; Mon, 14 Jan 2013 05:07:55 -0500 Message-ID: <50F3D8F7.5010400@redhat.com> Date: Mon, 14 Jan 2013 11:07:51 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <50F3BEE2.5090802@gmail.com> <50F3CB54.6080506@redhat.com> <50F3CFDD.2000003@gmail.com> In-Reply-To: <50F3CFDD.2000003@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] 100% CPU when sockfd is half-closed and unexpected behavior for qemu_co_send() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Yuan Cc: Anthony Liguori , qemu-devel@nongnu.org, Stefan Hajnoczi 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