Add an error message for xs_bind
Subsystems (3)
PATCH 1/1 Add an error message for xs_bind
xs_bind4 doesn't log an error when it can't get a reserved source port due to them all being in use. This situation can be hard to debug when it is intermittent or you don't know what to look for in the debug output. Add an error message describing how to resolve this problem when it happens.
--- net/sunrpc/xprtsock.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
net/sunrpc/xprtsock.c +12 -0
@@ -1563,6 +1563,12 @@ static int xs_bind4(struct sock_xprt *transport, struct socket *sock)if (port > last) nloop++; }while (err == -EADDRINUSE && nloop !=2 ); +if (err == -EADDRINUSE && nloop ==2 && transport->xprt.resvport) { +printk ("RPC: %s %pI4: cannot bind reserved source port, " +"too many ports already in use. " +"consider increasing xprt_max_resvport.\n" , + __func__, &myaddr.sin_addr); + }dprintk ("RPC: %s %pI4:%u: %s (%d)\n" , __func__, &myaddr.sin_addr, port, err ?"failed" :"ok" , err);
@@ -1596,6 +1602,12 @@ static int xs_bind6(struct sock_xprt *transport, struct socket *sock)if (port > last) nloop++; }while (err == -EADDRINUSE && nloop !=2 ); +if (err == -EADDRINUSE && nloop ==2 && transport->xprt.resvport) { +printk ("RPC: %s %pI6: cannot bind reserved source port, " +"too many ports already in use. " +"consider increasing xprt_max_resvport.\n" , + __func__, &myaddr.sin6_addr); + }dprintk ("RPC: xs_bind6 %pI6:%u: %s (%d)\n" , &myaddr.sin6_addr, port, err ?"failed" :"ok" , err);return err;