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

Dave Kleikamp shaggy at linux.vnet.ibm.com
Thu Apr 17 22:03:55 GMT 2008


On Thu, 2008-04-17 at 16:59 -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.

I've got mixed feelings about this.  It's good to get rid of the
signals, but I'm not very wild about polling.  I guess I'm leaning
toward this being a slight improvement, but I wonder if there's a better
solution.

> Signed-off-by: Jeff Layton <jlayton at redhat.com>
-- 
David Kleikamp
IBM Linux Technology Center



More information about the linux-cifs-client mailing list