[linux-cifs-client] [PATCH 2/3] [CIFS] convert cifs_demultiplex_thread to use nonblocking sockets

Christoph Hellwig hch at infradead.org
Thu May 1 16:30:43 GMT 2008

On Thu, Apr 17, 2008 at 04:59:05PM -0400, Jeff Layton wrote:
> Currently, cifs_demultiplex_thread uses blocking calls to
> kernel_recvmsg to receive data. These calls do not return immediately
> when kthread_stop tries to wake the thread, so cifs_mount and
> cifs_umount also signal the thread to make it break out of kernel_recvmsg.
> This patch converts cifs_demultiplex_thread to repeatedly check the
> socket with a TIOCINQ ioctl to see if there is data waiting. If there
> isn't then it sleeps a bit and polls again. If there is data then
> we call kernel_recvmsg in non-blocking mode to get it. Since we're
> polling like this, we can check kthread_should_stop on each poll and
> no longer need to signal when tearing down the thread.

Wouldn't it be better if we do real event driver non-blocking I/O,
like an poll or epoll loop in userspace.  I don't think this has
been done in kernelspace before, but I don't see any fundamental reason
why we can't do it. 

More information about the linux-cifs-client mailing list