[OpenAFS-devel] code to "down" unreachable hosts in src/rx/rx_packet.c is unreachable?
Derrick Brashear
shadow@gmail.com
Sun, 9 Nov 2008 22:52:06 -0500
On Sun, Nov 9, 2008 at 3:52 PM, Adam Megacz <megacz@cs.berkeley.edu> wrote:
>
> I noticed that the following useful piece of code at
> src/rx/rx_packet.c:2431 (CVS HEAD). I could be mistaken, but it
> appears that the body of the if-block is unreachable on
> non-AFS_NT40_ENV platforms:
Misleading. The kernels of Linux and MacOS *are* non-AFS_NT40_ENV platforms.
> /* Some systems are nice and tell us right away that we cannot
> * reach this recipient by returning an error code.
> * So, when this happens let's "down" the host NOW so
> * we don't sit around waiting for this host to timeout later.
> */
> if (call &&
> #ifdef AFS_NT40_ENV
> code == -1 && WSAGetLastError() == WSAEHOSTUNREACH
> #elif defined(AFS_LINUX20_ENV) && defined(KERNEL)
> code == -ENETUNREACH
> #elif defined(AFS_DARWIN_ENV) && defined(KERNEL)
> code == EHOSTUNREACH
> #else
> 0
> #endif
> )
>
> The variable "code" is the return value from osi_NetSend() on line
> 2421, a function which simply relays the return value of
> rxi_Sendmsg(). Both the lwp and pthread implementations of
> rxi_Sendmsg() appear to return only 0 or -1, never an error code.
And the kernel implementation, which is neither lwp or pthread,
returns the result (on Linux) of sock_sendmsg...
It's very much the intended situation. The code paths tested are
implemented. If you can implement and test more, we'd review them for
inclusion.
Derrick