From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:53289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSn83-00053M-Et for qemu-devel@nongnu.org; Fri, 11 May 2012 06:31:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSn80-0007jO-Dk for qemu-devel@nongnu.org; Fri, 11 May 2012 06:31:19 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:40165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSn80-0007j0-5K for qemu-devel@nongnu.org; Fri, 11 May 2012 06:31:16 -0400 Received: by pbbro12 with SMTP id ro12so4260290pbb.4 for ; Fri, 11 May 2012 03:31:11 -0700 (PDT) From: Ronnie Sahlberg Date: Fri, 11 May 2012 20:22:01 +1000 Message-Id: <1336731722-17743-1-git-send-email-ronniesahlberg@gmail.com> Subject: [Qemu-devel] [PATCH 0/1] ISCSI: Only set read-event if we have i/o in flight List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, kwolf@redhat.com List, Kevin Please find a small patch to the iscsi driver to only set the fd handler for read events IF we have i/o in flight and we are thus waiting for replies coming back from the target. There are situations where qemu_aio_set_fd_handler(fd, read_callback, ... will invoke the read_callback even if there is no fd/socket error and there are also no bytes to read from the descriptor. This interacts bad with libiscsi which when invoked for POLLIN assumes that there is data to read and if ioctl(...FIONREAD...) returns 0 bytes that this indicates a socket failure/error/closure. I dont know if that is expected behaviour from qemu_aio_set_fd_handler or not, but aside from target-initiated NOPs, we shouldnt expect there to be any reason to read from the socket anyway unless we have i/o in flight and are waiting for replies, so this would also avoid eating some cpu invoking the read_callback when falsely. regards ronnie sahlberg