[linux-cifs-client] [PATCH 2/3] [CIFS] convert
cifs_demultiplex_thread to use nonblocking sockets
Jeff Layton
jlayton at redhat.com
Fri Apr 18 00:04:28 GMT 2008
On Thu, 17 Apr 2008 17:03:55 -0500
Dave Kleikamp <shaggy at linux.vnet.ibm.com> wrote:
> 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.
>
Thanks for looking, Dave.
As best I can tell, this is more or less how the RPC code works (well,
at least the TCP-based stuff). There could certainly be a better way.
I'm definitely open to suggestions on this.
--
Jeff Layton <jlayton at redhat.com>
More information about the linux-cifs-client
mailing list