[PATCH] Fix bug 9412 - SMB2 server doesn't support recvfile.

Jeremy Allison jra at samba.org
Thu May 22 15:24:03 MDT 2014


On Thu, May 22, 2014 at 10:24:13AM +0800, Jones wrote:
> 2014-04-18 0:10 GMT+08:00 Jeremy Allison <jra at samba.org>:
>      (and remember your trace shows
>      EAGAIN coming back explicitly
>      after we've remove the O_NONBLOCK
>      from the socket flag).
> 
> Hello Jeremy,
> 
> Yes! this symptom was a bit confusing for me,
> after digging further found that source, 
> this EAGAIN is came from kernel tcp_recvmsg()
> @ linux-3.4.6/net/ipv4/tcp.c
> ...
> if (!timeo) {
> copied = -EAGAIN;  // <--- came from here.
> break;
> }
> ...
> 
> Excuse me to explain more about my linux box, 
> though following part hmm ... just a bit samba code involved, 
> most of them are inside kernel.

Yeah, looks like your custom splice
impliticly sets a SO_RCVTIMEO on
the socket.

Looking at the man page for recv()
we have:

       EAGAIN or EWOULDBLOCK
              The socket is marked nonblocking and the receive operation would block, or a receive timeout had been set  and  the
              timeout  expired before data was received.  POSIX.1-2001 allows either error to be returned for this case, and does
              not require these constants to have the same value, so a portable application should check for both possibilities.

so it is possible that even when
the socket it set blocking that
a recv() or splice() call can
return EAGAIN or EWOULDBLOCK.

I'll look at the code changes
needed for this.

Jeremy.


More information about the samba-technical mailing list