SUNRPC: ECONNREFUSED should cause a rebind.

If you
- mount and NFSv3 filesystem
- do some file locking which requires the server
to make a GRANT call back
- unmount
- mount again and do the same locking

then the second attempt at locking suffers a 30 second delay.
Unmounting and remounting causes lockd to stop and restart,
which causes it to bind to a new port.
The server still thinks the old port is valid and gets ECONNREFUSED
when trying to contact it.
ECONNREFUSED should be seen as a hard error that is not worth
retrying. Rebinding is the only reasonable response.

This patch forces a rebind if that makes sense.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>

authored by

NeilBrown and committed by
Trond Myklebust
fd01b259 3bde7afd

+8
+8
net/sunrpc/clnt.c
··· 1903 1903 task->tk_status = 0; 1904 1904 switch (status) { 1905 1905 case -ECONNREFUSED: 1906 + /* A positive refusal suggests a rebind is needed. */ 1907 + if (RPC_IS_SOFTCONN(task)) 1908 + break; 1909 + if (clnt->cl_autobind) { 1910 + rpc_force_rebind(clnt); 1911 + task->tk_action = call_bind; 1912 + return; 1913 + } 1906 1914 case -ECONNRESET: 1907 1915 case -ECONNABORTED: 1908 1916 case -ENETUNREACH: