mount: don't bind a socket needlessly.

When clnt_ping() calls get_socket(), get_socket() will create a socket,
call bind() to choose an unused local port, and then connect to the
given address.

The "bind()" call is unnecessary and problematic.
It is unnecessary as the "connect()" call will bind the socket as
It is problematic as it requires a completely unused port number, rather
than just a port number which isn't currently in use for connecting to
the given remote address.
If all local ports (net.ipv4.ip_local_port_range) are in use, the bind()
will fail.  However the connect() call will only fail if all those port
are in use for connecting to the same address.

So remove the unnecessary bind() call.

Signed-off-by: NeilBrown <>
Signed-off-by: Steve Dickson <>
1 file changed