diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-03-04 17:29:33 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-03-25 12:04:10 -0400 |
commit | 3ed5e2a2c394df4e03a680842c2d07a8680f133b (patch) | |
tree | 83050928d116f2079147f6de8c77860a4ec76f27 /net/sunrpc/clnt.c | |
parent | 1166fde6a923c30f4351515b6a9a1efc513e7d00 (diff) |
SUNRPC: Report network/connection errors correctly for SOFTCONN rpc tasks
In the case of a SOFTCONN rpc task, we really want to ensure that it
reports errors like ENETUNREACH back to the caller. Currently, only
some of these errors are being reported back (connect errors are not),
and they are being converted by the RPC layer into EIO.
Reported-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index dcc446e7fbf6..b95a0a2d5eea 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -1644,22 +1644,26 @@ call_connect_status(struct rpc_task *task) | |||
1644 | 1644 | ||
1645 | dprint_status(task); | 1645 | dprint_status(task); |
1646 | 1646 | ||
1647 | task->tk_status = 0; | ||
1648 | if (status >= 0 || status == -EAGAIN) { | ||
1649 | clnt->cl_stats->netreconn++; | ||
1650 | task->tk_action = call_transmit; | ||
1651 | return; | ||
1652 | } | ||
1653 | |||
1654 | trace_rpc_connect_status(task, status); | 1647 | trace_rpc_connect_status(task, status); |
1655 | switch (status) { | 1648 | switch (status) { |
1656 | /* if soft mounted, test if we've timed out */ | 1649 | /* if soft mounted, test if we've timed out */ |
1657 | case -ETIMEDOUT: | 1650 | case -ETIMEDOUT: |
1658 | task->tk_action = call_timeout; | 1651 | task->tk_action = call_timeout; |
1659 | break; | 1652 | return; |
1660 | default: | 1653 | case -ECONNREFUSED: |
1661 | rpc_exit(task, -EIO); | 1654 | case -ECONNRESET: |
1655 | case -ENETUNREACH: | ||
1656 | if (RPC_IS_SOFTCONN(task)) | ||
1657 | break; | ||
1658 | /* retry with existing socket, after a delay */ | ||
1659 | case 0: | ||
1660 | case -EAGAIN: | ||
1661 | task->tk_status = 0; | ||
1662 | clnt->cl_stats->netreconn++; | ||
1663 | task->tk_action = call_transmit; | ||
1664 | return; | ||
1662 | } | 1665 | } |
1666 | rpc_exit(task, status); | ||
1663 | } | 1667 | } |
1664 | 1668 | ||
1665 | /* | 1669 | /* |