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


Reply via email to